mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-01-03 23:42:28 +03:00
Added positive test case for OIDC implementation
- To continue coverage and spec cases next.
This commit is contained in:
@@ -60,15 +60,19 @@ class JwtSigningKey
|
||||
throw new InvalidKeyException("Only RS256 keys are currently supported. Found key using {$jwk['alg']}");
|
||||
}
|
||||
|
||||
if ($jwk['use'] !== 'sig') {
|
||||
throw new InvalidKeyException("Only signature keys are currently supported. Found key for use {$jwk['sig']}");
|
||||
if (empty($jwk['use'])) {
|
||||
throw new InvalidKeyException('A "use" parameter on the provided key is expected');
|
||||
}
|
||||
|
||||
if (empty($jwk['e'] ?? '')) {
|
||||
if ($jwk['use'] !== 'sig') {
|
||||
throw new InvalidKeyException("Only signature keys are currently supported. Found key for use {$jwk['use']}");
|
||||
}
|
||||
|
||||
if (empty($jwk['e'])) {
|
||||
throw new InvalidKeyException('An "e" parameter on the provided key is expected');
|
||||
}
|
||||
|
||||
if (empty($jwk['n'] ?? '')) {
|
||||
if (empty($jwk['n'])) {
|
||||
throw new InvalidKeyException('A "n" parameter on the provided key is expected');
|
||||
}
|
||||
|
||||
|
||||
@@ -76,11 +76,12 @@ class OpenIdConnectIdToken
|
||||
* Validate all possible parts of the id token.
|
||||
* @throws InvalidTokenException
|
||||
*/
|
||||
public function validate(string $clientId)
|
||||
public function validate(string $clientId): bool
|
||||
{
|
||||
$this->validateTokenStructure();
|
||||
$this->validateTokenSignature();
|
||||
$this->validateTokenClaims($clientId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user