Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function authenticate(TokenInterface $token) |
||
28 | { |
||
29 | if (!$this->supports($token)) { |
||
30 | return null; |
||
31 | } |
||
32 | |||
33 | /** @var OAuth2Token $token */ |
||
34 | $accessToken = $token->getAccessToken(); |
||
35 | |||
36 | if (true === $accessToken->hasExpired()) { |
||
37 | throw new BadCredentialsException('The access token has expired.'); |
||
38 | } |
||
39 | |||
40 | try { |
||
41 | $token->setAuthenticated(true); |
||
42 | |||
43 | return $token; |
||
44 | } catch (\Exception $e) { |
||
45 | throw new AuthenticationException($e->getMessage(), $e->getCode(), $e); |
||
46 | } |
||
47 | } |
||
48 | |||
57 |