-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add non-repudiation signature validation methods
- Loading branch information
Showing
14 changed files
with
328 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
import { test, skippable, flow, modules } from '../runner.js' | ||
import { | ||
test, | ||
skippable, | ||
rejects, | ||
flow, | ||
modules, | ||
nonRepudiation, | ||
plan, | ||
variant, | ||
} from '../runner.js' | ||
|
||
for (const module of modules('invalid-signature')) { | ||
test.serial(skippable(flow()), module) | ||
if (nonRepudiation(plan, variant)) { | ||
test.serial(rejects(flow()), module, 'JWT signature verification failed') | ||
} else { | ||
test.serial(skippable(flow()), module) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Function: validateIdTokenSignature() | ||
|
||
[💗 Help the project](https://github.com/sponsors/panva) | ||
|
||
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva). | ||
|
||
*** | ||
|
||
▸ **validateIdTokenSignature**(`as`, `ref`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Validates the JWS Signature of an ID Token included in results previously resolved from | ||
[processAuthorizationCodeOpenIDResponse](processAuthorizationCodeOpenIDResponse.md), [processRefreshTokenResponse](processRefreshTokenResponse.md), or | ||
[processDeviceCodeResponse](processDeviceCodeResponse.md) for non-repudiation purposes. | ||
|
||
Note: Validating signatures of ID Tokens received via direct communication between the Client and | ||
the Token Endpoint (which it is here) is not mandatory since the TLS server validation is used to | ||
validate the issuer instead of checking the token signature. You only need to use this method for | ||
non-repudiation purposes. | ||
|
||
Note: Supports only digital signatures. | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| ------ | ------ | ------ | | ||
| `as` | [`AuthorizationServer`](../interfaces/AuthorizationServer.md) | Authorization Server Metadata. | | ||
| `ref` | [`TokenEndpointResponse`](../interfaces/TokenEndpointResponse.md) \| [`OpenIDTokenEndpointResponse`](../interfaces/OpenIDTokenEndpointResponse.md) | Value previously resolved from [processAuthorizationCodeOpenIDResponse](processAuthorizationCodeOpenIDResponse.md), [processRefreshTokenResponse](processRefreshTokenResponse.md), or [processDeviceCodeResponse](processDeviceCodeResponse.md). | | ||
| `options`? | [`ValidateSignatureOptions`](../interfaces/ValidateSignatureOptions.md) | - | | ||
|
||
## Returns | ||
|
||
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Resolves if the signature validates, rejects otherwise. | ||
|
||
## See | ||
|
||
[OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Function: validateJwtIntrospectionSignature() | ||
|
||
[💗 Help the project](https://github.com/sponsors/panva) | ||
|
||
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva). | ||
|
||
*** | ||
|
||
▸ **validateJwtIntrospectionSignature**(`as`, `ref`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Validates the JWS Signature of an JWT [Response](https://developer.mozilla.org/docs/Web/API/Response) body of responses previously processed by | ||
[processIntrospectionResponse](processIntrospectionResponse.md) for non-repudiation purposes. | ||
|
||
Note: Validating signatures of JWTs received via direct communication between the Client and a | ||
TLS-secured Endpoint (which it is here) is not mandatory since the TLS server validation is used | ||
to validate the issuer instead of checking the token signature. You only need to use this method | ||
for non-repudiation purposes. | ||
|
||
Note: Supports only digital signatures. | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| ------ | ------ | ------ | | ||
| `as` | [`AuthorizationServer`](../interfaces/AuthorizationServer.md) | Authorization Server Metadata. | | ||
| `ref` | [`Response`](https://developer.mozilla.org/docs/Web/API/Response) | Response previously processed by [processIntrospectionResponse](processIntrospectionResponse.md). | | ||
| `options`? | [`ValidateSignatureOptions`](../interfaces/ValidateSignatureOptions.md) | - | | ||
|
||
## Returns | ||
|
||
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Resolves if the signature validates, rejects otherwise. | ||
|
||
## See | ||
|
||
[draft-ietf-oauth-jwt-introspection-response-12 - JWT Response for OAuth Token Introspection](https://www.ietf.org/archive/id/draft-ietf-oauth-jwt-introspection-response-12.html#section-5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Function: validateJwtUserinfoSignature() | ||
|
||
[💗 Help the project](https://github.com/sponsors/panva) | ||
|
||
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by [becoming a sponsor](https://github.com/sponsors/panva). | ||
|
||
*** | ||
|
||
▸ **validateJwtUserinfoSignature**(`as`, `ref`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Validates the JWS Signature of a JWT [Response](https://developer.mozilla.org/docs/Web/API/Response) body of response previously processed by | ||
[processUserInfoResponse](processUserInfoResponse.md) for non-repudiation purposes. | ||
|
||
Note: Validating signatures of JWTs received via direct communication between the Client and a | ||
TLS-secured Endpoint (which it is here) is not mandatory since the TLS server validation is used | ||
to validate the issuer instead of checking the token signature. You only need to use this method | ||
for non-repudiation purposes. | ||
|
||
Note: Supports only digital signatures. | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| ------ | ------ | ------ | | ||
| `as` | [`AuthorizationServer`](../interfaces/AuthorizationServer.md) | Authorization Server Metadata. | | ||
| `ref` | [`Response`](https://developer.mozilla.org/docs/Web/API/Response) | Response previously processed by [processUserInfoResponse](processUserInfoResponse.md). | | ||
| `options`? | [`ValidateSignatureOptions`](../interfaces/ValidateSignatureOptions.md) | - | | ||
|
||
## Returns | ||
|
||
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | ||
|
||
Resolves if the signature validates, rejects otherwise. | ||
|
||
## See | ||
|
||
[OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo) |
59 changes: 0 additions & 59 deletions
59
docs/interfaces/ValidateDetachedSignatureResponseOptions.md
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...erfaces/ValidateJwtAuthResponseOptions.md → docs/interfaces/ValidateSignatureOptions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.