Skip to content

Commit

Permalink
Merge pull request #5 from robbytaylor/master
Browse files Browse the repository at this point in the history
fix: token isn't valid if the issuing client is revoked
  • Loading branch information
Robert Kummer authored Aug 17, 2018
2 parents e4ac019 + ffb17bb commit 44047d1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Http/Controllers/IntrospectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\JsonResponse;
use Laravel\Passport\Bridge\AccessTokenRepository;
use Laravel\Passport\ClientRepository;
use Laravel\Passport\Passport;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Token;
Expand Down Expand Up @@ -31,22 +32,30 @@ class IntrospectionController
*/
private $accessTokenRepository;

/**
* @var \Laravel\Passport\ClientRepository
*/
private $clientRepository;

/**
* constructing IntrospectionController
*
* @param \Lcobucci\JWT\Parser $jwt
* @param \League\OAuth2\Server\ResourceServer $resourceServer
* @param \Laravel\Passport\Bridge\AccessTokenRepository $accessTokenRepository
* @param \Laravel\Passport\ClientRepository
*/
public function __construct(
Parser $jwt,
ResourceServer $resourceServer,
AccessTokenRepository $accessTokenRepository
AccessTokenRepository $accessTokenRepository,
ClientRepository $clientRepository
)
{
$this->jwt = $jwt;
$this->resourceServer = $resourceServer;
$this->accessTokenRepository = $accessTokenRepository;
$this->clientRepository = $clientRepository;
}

/**
Expand Down Expand Up @@ -147,6 +156,10 @@ private function verifyToken(Token $token) : bool
return false;
}

if ($this->clientRepository->revoked($token->getClaim('aud'))) {
return false;
}

return true;
} catch (\Exception $exception) {
}
Expand Down

0 comments on commit 44047d1

Please sign in to comment.