1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Xervice\Security\Business\Model\Provider; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
use DataProvider\AuthenticatorDataProvider; |
|
|
|
|
8
|
|
|
use Xervice\Security\Business\Dependency\Authenticator\AuthenticatorInterface; |
9
|
|
|
use Xervice\Security\Business\Exception\SecurityException; |
10
|
|
|
|
11
|
|
|
class SecurityProvider implements SecurityProviderInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var \Xervice\Security\Business\Dependency\Authenticator\AuthenticatorInterface[] |
15
|
|
|
*/ |
16
|
|
|
private $authenticatorList; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* SecurityProvider constructor. |
20
|
|
|
* |
21
|
|
|
* @param array $authenticatorList |
22
|
|
|
*/ |
23
|
3 |
|
public function __construct(array $authenticatorList) |
24
|
|
|
{ |
25
|
3 |
|
foreach ($authenticatorList as $name => $authClass) { |
26
|
3 |
|
$this->add( |
27
|
3 |
|
$name, |
28
|
3 |
|
new $authClass() |
29
|
|
|
); |
30
|
|
|
} |
31
|
3 |
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $name |
35
|
|
|
* @param \Xervice\Security\Business\Dependency\Authenticator\AuthenticatorInterface $authenticator |
36
|
|
|
*/ |
37
|
3 |
|
public function add(string $name, AuthenticatorInterface $authenticator): void |
38
|
|
|
{ |
39
|
3 |
|
$this->authenticatorList[$name] = $authenticator; |
40
|
3 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param string $name |
44
|
|
|
* |
45
|
|
|
* @return \Xervice\Security\Business\Dependency\Authenticator\AuthenticatorInterface |
46
|
|
|
* @throws \Xervice\Security\Business\Exception\SecurityException |
47
|
|
|
*/ |
48
|
3 |
|
public function get(string $name): AuthenticatorInterface |
49
|
|
|
{ |
50
|
3 |
|
if (!isset($this->authenticatorList[$name])) { |
51
|
|
|
throw new SecurityException( |
52
|
|
|
sprintf( |
53
|
|
|
'Authenticator %s does not exist', |
54
|
|
|
$name |
55
|
|
|
) |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
3 |
|
return $this->authenticatorList[$name]; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param string $name |
64
|
|
|
* @param \DataProvider\AuthenticatorDataProvider $dataProvider |
65
|
|
|
* |
66
|
|
|
* @throws \Xervice\Security\Business\Exception\SecurityException |
67
|
|
|
*/ |
68
|
3 |
|
public function authenticate(string $name, AuthenticatorDataProvider $dataProvider): void |
69
|
|
|
{ |
70
|
3 |
|
$this->get($name)->authenticate($dataProvider); |
71
|
|
|
} |
72
|
|
|
} |
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