Пример #1
0
 /** @test */
 public function it_invalidates_old_tokens()
 {
     $this->setExpectedException('Vercoutere\\LaravelJwt\\Exceptions\\InvalidTokenException');
     $this->token->renew();
     Token::validate($this->token->getToken());
 }
Пример #2
0
 /**
  * Authenticates and logs a user in from a token.
  * 
  * @param   String $token
  * 
  * @return Boolean
  */
 public function authenticateWithToken($token)
 {
     try {
         $token = Token::validate($token);
     } catch (InvalidTokenException $e) {
         return false;
     }
     $this->token = $token;
     // Retrieve the user from the handle in the token.
     $user = $this->provider->retrieveByCredentials([config('jwt.handle') => $token->getPayload()['aud']]);
     $this->login($user);
     return true;
 }