Total Complexity | 7 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 86.67% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class CasUserProvider implements CasUserProviderInterface |
||
18 | { |
||
19 | /** |
||
20 | * {@inheritdoc} |
||
21 | */ |
||
22 | 2 | public function loadUserByResponse(ResponseInterface $response): CasUserInterface |
|
23 | { |
||
24 | try { |
||
25 | 2 | $introspect = Introspector::detect($response); |
|
26 | } catch (InvalidArgumentException $exception) { |
||
27 | throw new AuthenticationException($exception->getMessage()); |
||
28 | } |
||
29 | |||
30 | 2 | if ($introspect instanceof ServiceValidate) { |
|
31 | 2 | return new CasUser($introspect->getCredentials()); |
|
32 | } |
||
33 | |||
34 | 2 | throw new AuthenticationException('Unable to load user from response.'); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 1 | public function loadUserByUsername(string $username) |
|
41 | { |
||
42 | 1 | throw new UnsupportedUserException(sprintf('Username "%s" does not exist.', $username)); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 1 | public function refreshUser(UserInterface $user) |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 1 | public function supportsClass(string $class) |
|
67 |