Skip to content

Commit

Permalink
use only one configuration to set the issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
abublihi committed Feb 3, 2024
1 parent a96dbae commit f01d45a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions config/passport-claims.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
| Issue Claim
|--------------------------------------------------------------------------
|
| Here you config the issue claim, weather to add it or not and what is the issuer.
| Here you config the issue claim. if null will not be set
| NOTE: it will set the `iss` claim ref: https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1
|
*/
'issuer_enabled' => env('JWT_ISSUER_ENABLED', false),
'issuer' => env('JWT_ISSUER'),
'issuer' => env('JWT_ISSUER', null),
];
2 changes: 1 addition & 1 deletion src/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private function convertToJWT() : Token
->relatedTo((string) $this->getUserIdentifier())
->withClaim('scopes', $this->getScopes());

if (config('passport-claims.issuer_enabled') && config('passport-claims.issuer')) {
if (config('passport-claims.issuer')) {
$jwt = $jwt->issuedBy(config('passport-claims.issuer'));
}

Expand Down
1 change: 0 additions & 1 deletion tests/AccessTokenClaimTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function test_jwt_has_iss_claim_when_configured()
$keys = (new RSA())->createKey(2048);

/* set custom claims, defined below this test */
app('config')->set('passport-claims.issuer_enabled', true);
app('config')->set('passport-claims.issuer', 'https://example.com');

/* create the laravel token */
Expand Down

0 comments on commit f01d45a

Please sign in to comment.