| Total Complexity | 11 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class AuthController |
||
| 21 | { |
||
| 22 | private $auth; |
||
| 23 | |||
| 24 | public function __construct(AuthScope $auth) |
||
| 25 | { |
||
| 26 | $this->auth = $auth; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function do(GuardInterface $guard) |
||
| 30 | { |
||
| 31 | if (!$guard->allows('do')) { |
||
| 32 | throw new ControllerException("Unauthorized permission 'do'", ControllerException::FORBIDDEN); |
||
| 33 | } |
||
| 34 | |||
| 35 | return 'ok'; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function token(AuthContextInterface $authContext) |
||
| 45 | } |
||
| 46 | |||
| 47 | public function login(AuthContextInterface $authContext, TokenStorageInterface $tokenStorage) |
||
| 54 | } |
||
| 55 | |||
| 56 | public function logout() |
||
| 57 | { |
||
| 58 | $this->auth->close(); |
||
| 59 | |||
| 60 | return 'closed'; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function token2() |
||
| 64 | { |
||
| 65 | if ($this->auth->getToken() !== null) { |
||
| 66 | return $this->auth->getToken()->getID(); |
||
| 67 | } |
||
| 68 | |||
| 69 | return 'none'; |
||
| 70 | } |
||
| 71 | |||
| 72 | public function token3() |
||
| 73 | { |
||
| 74 | return $this->auth->getToken()->getPayload(); |
||
| 75 | } |
||
| 76 | |||
| 77 | public function login2(TokenStorageInterface $tokenStorage) |
||
| 84 | } |
||
| 85 | } |
||
| 86 |