1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\Module\authorize\Controller; |
6
|
|
|
|
7
|
|
|
use SimpleSAML\Auth; |
8
|
|
|
use SimpleSAML\Configuration; |
9
|
|
|
use SimpleSAML\Error; |
10
|
|
|
use SimpleSAML\Module; |
11
|
|
|
use SimpleSAML\XHTML\Template; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Controller class for the authorize module. |
15
|
|
|
* |
16
|
|
|
* This class serves the different views available in the module. |
17
|
|
|
* |
18
|
|
|
* @package SimpleSAML\Module\authorize |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
class Authorize |
22
|
|
|
{ |
23
|
|
|
/** @var \SimpleSAML\Configuration */ |
24
|
|
|
protected $config; |
25
|
|
|
|
26
|
|
|
/** @var \SimpleSAML\Session */ |
27
|
|
|
protected $session; |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Controller constructor. |
32
|
|
|
* |
33
|
|
|
* It initializes the global configuration and auth source configuration for the controllers implemented here. |
34
|
|
|
* |
35
|
|
|
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers. |
36
|
|
|
* @param \SimpleSAML\Session $session The session to use by the controllers. |
37
|
|
|
* |
38
|
|
|
* @throws \Exception |
39
|
|
|
*/ |
40
|
|
|
public function __construct( |
41
|
|
|
Configuration $config, |
42
|
|
|
Session $session |
|
|
|
|
43
|
|
|
) { |
44
|
|
|
$this->config = $config; |
45
|
|
|
$this->session = $session; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Show a 403 Forbidden page about not authorized to access an application. |
51
|
|
|
* |
52
|
|
|
* @param \Symfony\Component\HttpFoundation\Request $request |
53
|
|
|
* @return \SimpleSAML\XHTML\Template |
54
|
|
|
*/ |
55
|
|
|
public function cardinality(Request $request): Template |
|
|
|
|
56
|
|
|
{ |
57
|
|
|
$stateId = $request->get('StateId', false); |
58
|
|
|
if ($stateId === false) { |
59
|
|
|
throw new Error\BadRequest('Missing required StateId query parameter.'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** @var array $state */ |
63
|
|
|
$state = Auth\State::loadState($stateId, 'authorize:Authorize'); |
64
|
|
|
|
65
|
|
|
$t = new Template($this->config, 'authorize:authorize_403.twig'); |
66
|
|
|
if (isset($state['Source']['auth'])) { |
67
|
|
|
$t->data['logoutURL'] = Module::getModuleURL( |
68
|
|
|
'core/authenticate.php', |
69
|
|
|
['as' => $state['Source']['auth']] |
70
|
|
|
) . "&logout"; |
71
|
|
|
} |
72
|
|
|
if (isset($state['authprocAuthorize_reject_msg'])) { |
73
|
|
|
$t->data['reject_msg'] = $state['authprocAuthorize_reject_msg']; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
$t->setStatusCode(403); |
77
|
|
|
return $t; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths