-
-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: gracefully handle mixed up response_type(s) order
- Loading branch information
Showing
9 changed files
with
126 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { expect } = require('chai'); | ||
|
||
const Provider = require('../../lib'); | ||
|
||
describe('response_types Provider configuration', () => { | ||
it('fixes common issues', () => { | ||
const provider = new Provider('https://op.example.com', { // eslint-disable-line no-new | ||
responseTypes: ['token id_token code', 'token id_token'], | ||
}); | ||
expect(i(provider).configuration('responseTypes')).to.eql(['code id_token token', 'id_token token']); | ||
}); | ||
|
||
it('throws when invalid types are configured', () => { | ||
expect(() => { | ||
new Provider('https://op.example.com', { // eslint-disable-line no-new | ||
responseTypes: ['id_token tokencode'], | ||
}); | ||
}).to.throw('unsupported response type: id_token tokencode'); | ||
}); | ||
|
||
it('validates none is always standalone', () => { | ||
expect(() => { | ||
new Provider('https://op.example.com', { // eslint-disable-line no-new | ||
responseTypes: ['none code'], | ||
}); | ||
}).to.throw('unsupported response type: none code'); | ||
}); | ||
}); |
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