forked from panva/node-oidc-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bump issAuthResp draft to -04
- Loading branch information
Showing
8 changed files
with
223 additions
and
8 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
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,29 @@ | ||
const cloneDeep = require('lodash/cloneDeep'); | ||
const merge = require('lodash/merge'); | ||
|
||
const config = cloneDeep(require('../default.config')); | ||
|
||
merge(config.features, { | ||
issAuthResp: { enabled: true }, | ||
jwtResponseModes: { enabled: true }, | ||
}); | ||
|
||
module.exports = { | ||
config, | ||
clients: [{ | ||
client_id: 'client', | ||
token_endpoint_auth_method: 'none', | ||
redirect_uris: ['https://client.example.com/cb'], | ||
grant_types: ['authorization_code', 'implicit'], | ||
scope: 'openid', | ||
response_types: [ | ||
'code id_token token', | ||
'code id_token', | ||
'code token', | ||
'code', | ||
'id_token token', | ||
'id_token', | ||
'none', | ||
], | ||
}], | ||
}; |
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,179 @@ | ||
const { expect } = require('chai'); | ||
|
||
const bootstrap = require('../test_helper'); | ||
|
||
describe('features.issAuthResp', () => { | ||
before(bootstrap(__dirname)); | ||
|
||
describe('enriched discovery', () => { | ||
it('shows the url now', function () { | ||
return this.agent.get('/.well-known/openid-configuration') | ||
.expect(200) | ||
.expect((response) => { | ||
expect(response.body).to.have.property('authorization_response_iss_parameter_supported', true); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('OAuth 2.0 Authorization Server Issuer Identifier in Authorization Response', () => { | ||
before(function () { return this.login(); }); | ||
|
||
it('response_type=code', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['iss'], false)) | ||
.expect(auth.validateClientLocation) | ||
.expect(auth.validateIss); | ||
}); | ||
|
||
it('response_type=code token', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code token', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['iss'], false)) | ||
.expect(auth.validateClientLocation) | ||
.expect(auth.validateIss); | ||
}); | ||
|
||
it('response_type=code id_token', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code id_token', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['code', 'state', 'id_token'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('response_type=code id_token token', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code id_token token', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['code', 'state', 'id_token', 'access_token', 'token_type', 'expires_in', 'scope'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('response_type=id_token token', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'id_token token', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['state', 'id_token', 'access_token', 'token_type', 'expires_in', 'scope'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('response_type=id_token', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'id_token', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['state', 'id_token'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('response_type=none', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'none', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['state', 'iss'])) | ||
.expect(auth.validateClientLocation) | ||
.expect(auth.validateIss); | ||
}); | ||
|
||
it('response_mode=jwt', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code', | ||
response_mode: 'jwt', | ||
scope: 'openid', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['response'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('error with regular response modes', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code', | ||
scope: 'openid profile', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['error', 'iss'], false)) | ||
.expect(auth.validateClientLocation) | ||
.expect(auth.validateIss); | ||
}); | ||
|
||
it('error with response_type none', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'none', | ||
scope: 'openid profile', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['error', 'iss'], false)) | ||
.expect(auth.validateClientLocation) | ||
.expect(auth.validateIss); | ||
}); | ||
|
||
it('error with response_mode=jwt', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code', | ||
response_mode: 'jwt', | ||
scope: 'openid profile', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validatePresence(['response'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
|
||
it('error with response_mode=jwt fragment', function () { | ||
const auth = new this.AuthorizationRequest({ | ||
response_type: 'code id_token', | ||
response_mode: 'jwt', | ||
scope: 'openid profile', | ||
}); | ||
|
||
return this.wrap({ route: '/auth', verb: 'get', auth }) | ||
.expect(303) | ||
.expect(auth.validateFragment) | ||
.expect(auth.validatePresence(['response'])) | ||
.expect(auth.validateClientLocation); | ||
}); | ||
}); | ||
}); |
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