예제 #1
0
파일: Listener.php 프로젝트: profcab/ilios
 public function handle(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     try {
         $token = new JwtToken($this->jwtKey);
         $token->setRequest($request);
         if ($token->isValidJwtRequest()) {
             $authToken = $this->authenticationManager->authenticate($token);
             $this->tokenStorage->setToken($authToken);
         }
     } catch (\UnexpectedValueException $e) {
         throw new BadCredentialsException('Invalid JSON Web Token: ' . $e->getMessage());
         return null;
     } catch (AuthenticationException $failed) {
         //We have a token with a bad user id, move on and let
         //another login method handle this
         return;
     }
     return;
 }