1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Limoncello\Auth\Authorization\PolicyDecision\Algorithms; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015-2019 [email protected] |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Limoncello\Auth\Contracts\Authorization\PolicyInformation\ContextInterface; |
22
|
|
|
use Psr\Log\LoggerInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @package Limoncello\Auth |
26
|
|
|
*/ |
27
|
|
|
class PoliciesOrSetsPermitOverrides extends BasePolicyOrSetAlgorithm |
28
|
|
|
{ |
29
|
|
|
use DefaultTargetSerializeTrait; |
30
|
|
|
|
31
|
|
|
/** @inheritdoc */ |
32
|
|
|
const METHOD = [self::class, 'evaluate']; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param ContextInterface $context |
36
|
|
|
* @param array $optimizedTargets |
37
|
|
|
* @param array $encPoliciesOrSets |
38
|
|
|
* @param LoggerInterface|null $logger |
39
|
|
|
* |
40
|
2 |
|
* @return array |
41
|
|
|
*/ |
42
|
|
|
public static function evaluate( |
43
|
|
|
ContextInterface $context, |
44
|
|
|
array $optimizedTargets, |
45
|
|
|
array $encPoliciesOrSets, |
46
|
2 |
|
?LoggerInterface $logger |
47
|
|
|
): array { |
48
|
|
|
return static::evaluatePermitOverrides($context, $optimizedTargets, $encPoliciesOrSets, $logger); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|