Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/KeyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@

class KeyRepository
{
public function getPrivateKey(): CryptKey
public function getPrivateKey(string $kid = "1"): CryptKey
{
$privateKey = config('passport.private_key')
?? 'file://' . Passport::keyPath('oauth-private.key');
return new CryptKey($privateKey);
$cryptKey = new CryptKey($privateKey);
$cryptKey->setKid($kid);
return $cryptKey;
}

public function getPublicKey(): CryptKey
public function getPublicKey(string $kid = "1"): CryptKey
{
$publicKey = config('passport.public_key')
?? 'file://' . Passport::keyPath('oauth-public.key');
return new CryptKey($publicKey);
$cryptKey = new CryptKey($publicKey);
$cryptKey->setKid($kid);
return $cryptKey;
}

public function getPublicKeyForClient(Client $client, $kid = null): CryptKey
public function getPublicKeyForClient(Client $client, string $kid = "1"): CryptKey
{
$publicKey = config('passport.public_key')
?? file_get_contents('file://' . Passport::keyPath('oauth-public.key'));
return new CryptKey($publicKey);
$cryptKey = new CryptKey($publicKey);
$cryptKey->setKid($kid);
return $cryptKey;
}

public function getAllPublicKeys()
Expand Down
2 changes: 1 addition & 1 deletion src/ProviderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function jwks(ProviderRepository $providerRepository)
'alg' => 'RS256',
'kty' => 'RSA',
'use' => 'sig',
'kid' => $crypt->kid ?? 1
'kid' => $crypt->kid,
];

if (!empty($crypt->x509)) {
Expand Down