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