1 | <?php |
||
33 | final class PdpService |
||
34 | { |
||
35 | /** |
||
36 | * @var PdpClientInterface |
||
37 | */ |
||
38 | private $client; |
||
39 | |||
40 | /** |
||
41 | * @var LoaResolutionService |
||
42 | */ |
||
43 | private $loaResolutionService; |
||
44 | |||
45 | /** |
||
46 | * @var \Psr\Log\LoggerInterface |
||
47 | */ |
||
48 | private $logger; |
||
49 | |||
50 | /** |
||
51 | * Identifier with which to identify stepup to the PDP endpoint. |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | private $clientId; |
||
56 | |||
57 | public function __construct(PdpClientInterface $client, LoaResolutionService $loaResolutionService, LoggerInterface $logger, $clientId) |
||
64 | |||
65 | /** |
||
66 | * Check if PDP is enabled for given the SP or IdP in current context. |
||
67 | * |
||
68 | * @param ResponseContext $context |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function isEnabledForSpOrIdp(ResponseContext $context) |
||
82 | |||
83 | /** |
||
84 | * Call the PDP endpoint and determine the LoA obligated by the policy decision. |
||
85 | * |
||
86 | * This method takes the original LoA required by the SP or IdP and |
||
87 | * returns either the same LoA, or a higher LoA of a higher LoA is |
||
88 | * obligated by the PDP endpoint. |
||
89 | * |
||
90 | * A policy decision can result in one of four situations: |
||
91 | * |
||
92 | * - access was denied (denied, indeterminate) |
||
93 | * - permit, without obligatory LoA |
||
94 | * - permit, with obligatory LoA lower than or equal to original required LoA -> original required LoA unaffectd |
||
95 | * - permit, with obligatory LoA higher than or original required LoA -> required LoA increased |
||
96 | * |
||
97 | * @param Loa $originalRequiredLoa |
||
98 | * @param string $subjectId |
||
99 | * @param string $idpEntityId |
||
100 | * @param string $spEntityId |
||
101 | * @param array $attributes |
||
102 | * @param string $clientIp |
||
103 | * @return Loa |
||
104 | */ |
||
105 | public function enforceObligatoryLoa(Loa $originalRequiredLoa, $subjectId, $idpEntityId, $spEntityId, array $attributes, $clientIp) |
||
158 | |||
159 | /** |
||
160 | * @param string[] $uris List of LoA URIs |
||
161 | * @return Loa The highest LoA found in the policy decision obligations |
||
162 | */ |
||
163 | private function findHighestObligatoryLoa(array $uris) |
||
185 | } |
||
186 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.