Skip to content

Commit

Permalink
feat: Authorization Server Issuer Identifier in Authorization Response
Browse files Browse the repository at this point in the history
Enables `iss` authorization response parameter for responses without
existing countermeasures against mix-up attacks.

This is a draft feature implementation. See the configuration
documentation in `features.issAuthResp`
  • Loading branch information
panva committed Jan 13, 2021
1 parent 5d440ca commit 3f67ee9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following draft specifications are implemented by oidc-provider.
- [JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens - draft 05][jwt-at]
- [JWT Response for OAuth Token Introspection - draft 09][jwt-introspection]
- [JWT Secured Authorization Response Mode for OAuth 2.0 (JARM) - draft 02][jarm]
- [OAuth 2.0 Authorization Server Issuer Identifier in Authorization Response][iss-auth-resp]
- [OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer (DPoP) - draft 01][dpop]
- [OAuth 2.0 JWT Secured Authorization Request (JAR)][jar]
- [OAuth 2.0 Pushed Authorization Requests - draft 03][par]
Expand Down Expand Up @@ -176,3 +177,4 @@ See the list of available emitted [event names](/docs/events.md) and their descr
[support-sponsor]: https://github.com/sponsors/panva
[par]: https://tools.ietf.org/html/draft-ietf-oauth-par-03
[rpinitiated-logout]: https://openid.net/specs/openid-connect-rpinitiated-1_0-01.html
[iss-auth-resp]: https://tools.ietf.org/html/draft-ietf-oauth-iss-auth-resp-00
14 changes: 14 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,20 @@ async function introspectionAllowedPolicy(ctx, client, token) {

</details>

### features.issAuthResp

[draft-ietf-oauth-iss-auth-resp-00](https://tools.ietf.org/html/draft-ietf-oauth-iss-auth-resp-00) - OAuth 2.0 Authorization Server Issuer Identifier in Authorization Response

Enables `iss` authorization response parameter for responses without existing countermeasures against mix-up attacks.


_**default value**_:
```js
{
enabled: false
}
```

### features.jwtIntrospection

[draft-ietf-oauth-jwt-introspection-response-09](https://tools.ietf.org/html/draft-ietf-oauth-jwt-introspection-response-09) - JWT Response for OAuth Token Introspection
Expand Down
4 changes: 4 additions & 0 deletions lib/actions/authorization/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module.exports = async function respond(ctx, next) {
out.session_state = processSessionState(ctx, params.redirect_uri);
}

if (instance(ctx.oidc.provider).configuration('features.issAuthResp.enabled')) {
out.iss = ctx.oidc.provider.issuer;
}

ctx.oidc.provider.emit('authorization.success', ctx, out);
debug('uid=%s %o', ctx.oidc.uid, out);

Expand Down
1 change: 1 addition & 0 deletions lib/actions/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = function discovery(ctx, next) {
issuer: ctx.oidc.issuer,
jwks_uri: ctx.oidc.urlFor('jwks'),
registration_endpoint: features.registration.enabled ? ctx.oidc.urlFor('registration') : undefined,
authorization_response_iss_parameter_supported: features.issAuthResp.enabled ? true : undefined,
response_modes_supported: ['form_post', 'fragment', 'query'],
response_types_supported: config.responseTypes,
scopes_supported: [...config.scopes].concat([...config.dynamicScopes].map((s) => s[DYNAMIC_SCOPE_LABEL]).filter(Boolean)),
Expand Down
10 changes: 10 additions & 0 deletions lib/helpers/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,16 @@ function getDefaults() {
*/
scriptNonce: webMessageResponseModeScriptNonce,
},

/*
* features.issAuthResp
*
* title: [draft-ietf-oauth-iss-auth-resp-00](https://tools.ietf.org/html/draft-ietf-oauth-iss-auth-resp-00) - OAuth 2.0 Authorization Server Issuer Identifier in Authorization Response
*
* description: Enables `iss` authorization response parameter for responses without
* existing countermeasures against mix-up attacks.
*/
issAuthResp: { enabled: false },
},

/*
Expand Down
6 changes: 6 additions & 0 deletions lib/helpers/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ const DRAFTS = new Map(Object.entries({
url: 'https://tools.ietf.org/html/draft-sakimura-oauth-wmrm-00',
version: [0, 'id-00', 'individual-draft-00'],
},
issAuthResp: {
name: 'OAuth 2.0 Authorization Server Issuer Identifier in Authorization Response - draft 00',
type: 'IETF OAuth Working Group draft',
url: 'https://tools.ietf.org/html/draft-ietf-oauth-iss-auth-resp-00',
version: ['draft-00'],
},
}));

module.exports = {
Expand Down

0 comments on commit 3f67ee9

Please sign in to comment.