| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 31 | 6 | public function authenticate(TokenInterface $token) |
|
| 32 | { |
||
| 33 | 6 | if ($this->code != $token->getCredentials()) { |
|
| 34 | 3 | throw new AuthenticationException("Authentication code does not match"); |
|
| 35 | } |
||
| 36 | 3 | $user = $token->getUser(); |
|
| 37 | // TODO: Provide a mechanism to get the real user object, and set user roles in token |
||
| 38 | 3 | $token = new UsernamePasswordToken($user, $token->getCredentials(), |
|
| 39 | 3 | $this->name, ['ROLE_USER']); |
|
| 40 | 3 | return $token; |
|
| 41 | } |
||
| 42 | } |
||
| 43 |