FOSSology
4.4.0
Open Source License Compliance by Open Source Software
CorsHelper.php
1
<?php
2
/*
3
SPDX-FileCopyrightText: © 2023 Siemens AG
4
SPDX-FileContributor: Gaurav Mishra <mishra.gaurav@siemens.com>
5
6
SPDX-License-Identifier: GPL-2.0-only
7
*/
8
9
namespace
Fossology\UI\Api\Helper
;
10
11
use Psr\Http\Message\ResponseInterface;
12
13
class
CorsHelper
14
{
21
public
static
function
addCorsHeaders
(ResponseInterface $response): ResponseInterface
22
{
23
global $SysConf;
24
return
$response
25
->withHeader(
'Access-Control-Allow-Origin'
, $SysConf[
'SYSCONFIG'
][
'CorsOrigins'
])
26
->withHeader(
'Access-Control-Expose-Headers'
,
'Look-at, X-Total-Pages, Retry-After'
)
27
->withHeader(
'Access-Control-Allow-Headers'
,
'X-Requested-With, Content-Type, Accept, Origin, Authorization, action, accesslevel, active, copyright, Content-Type, description, filename, filesizemax, filesizemin, folderDescription, folderId, folderName, groupName, ignoreScm, applyGlobal, license, limit, name, page, parent, parentFolder, public, reportFormat, searchType, tag, upload, uploadDescription, uploadId, uploadType'
)
28
->withHeader(
'Access-Control-Allow-Methods'
,
'GET, POST, PUT, DELETE, PATCH, OPTIONS'
)
29
->withHeader(
'Access-Control-Allow-Credentials'
,
'true'
);
30
}
31
}
Fossology\UI\Api\Helper\CorsHelper
Definition:
CorsHelper.php:14
Fossology\UI\Api\Helper\CorsHelper\addCorsHeaders
static addCorsHeaders(ResponseInterface $response)
Definition:
CorsHelper.php:21
Fossology\UI\Api\Helper
REST api helper classes.
src
www
ui
api
Helper
CorsHelper.php
Generated on Mon Nov 18 2024 07:37:14 for FOSSology by
1.9.1