1
0
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:
Dan Brown
2021-10-12 00:01:51 +01:00
parent 6b182a435a
commit f3d54e4a2d
3 changed files with 128 additions and 5 deletions

View File

@@ -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');
}

View File

@@ -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;
}
/**