Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function authenticate(TokenInterface $token) |
||
28 | { |
||
29 | $user = $this->ipToUserMapper->getInternalUser($token->getClientIp()); |
||
30 | if ($user) { |
||
31 | $user = $this->userProvider->loadUserByUsername($user); |
||
32 | } |
||
33 | if ($user) |
||
34 | { |
||
35 | $authenticatedToken = new IPToken($user->getRoles()); |
||
36 | $authenticatedToken->setClientIp($token->getClientIp())->setUser($user); |
||
37 | $authenticatedToken->setAuthenticated(true); |
||
38 | |||
39 | return $authenticatedToken; |
||
40 | } |
||
41 | |||
42 | throw new AuthenticationException('No valid IP auth found'); |
||
43 | } |
||
44 | } |