Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
hafezdivandari committed Oct 23, 2024
1 parent 5b14253 commit 92fb400
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/AuthorizationValidators/BearerTokenValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Lcobucci\JWT\Exception;
use Lcobucci\JWT\Signer\Key\InMemory;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Lcobucci\JWT\Token\Plain;
use Lcobucci\JWT\UnencryptedToken;
use Lcobucci\JWT\Validation\Constraint\LooseValidAt;
use Lcobucci\JWT\Validation\Constraint\SignedWith;
Expand Down Expand Up @@ -85,9 +84,9 @@ private function initJwtConfiguration(): void
}

/**
* Configure the request instance.
* Configure the validated authorization request instance.
*/
protected function withRequest(ServerRequestInterface $request, Plain $token): ServerRequestInterface
protected function withValidatedRequest(ServerRequestInterface $request, UnencryptedToken $token): ServerRequestInterface
{
return $request;
}
Expand Down Expand Up @@ -135,7 +134,7 @@ public function validateAuthorization(ServerRequestInterface $request): ServerRe
}

// Return the request with additional attributes
return $this->withRequest($request
return $this->withValidatedRequest($request
->withAttribute('oauth_access_token_id', $claims->get('jti'))
->withAttribute('oauth_client_id', $claims->get('aud')[0])
->withAttribute('oauth_user_id', $claims->get('sub'))
Expand Down
4 changes: 2 additions & 2 deletions src/Entities/Traits/AccessTokenTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function initJwtConfiguration(): void
/**
* Configure the JWT builder instance.
*/
protected function withBuilder(Builder $builder): Builder
protected function withJwtBuilder(Builder $builder): Builder
{
return $builder;
}
Expand All @@ -70,7 +70,7 @@ private function convertToJWT(): Token
{
$this->initJwtConfiguration();

return $this->withBuilder($this->jwtConfiguration->builder()
return $this->withJwtBuilder($this->jwtConfiguration->builder()
->permittedFor($this->getClient()->getIdentifier())
->identifiedBy($this->getIdentifier())
->issuedAt(new DateTimeImmutable())
Expand Down

0 comments on commit 92fb400

Please sign in to comment.