Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jwksURI override option #1321

Merged
merged 3 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"zuul-ngrok": "4.0.0"
},
"dependencies": {
"auth0-js": "^9.4.1",
"auth0-js": "^9.4.2",
"blueimp-md5": "2.3.1",
"fbjs": "^0.3.1",
"immutable": "^3.7.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Object {

exports[`webAuthOverrides should omit overrides that are not compatible with WebAuth 1`] = `
Object {
"__jwks_uri": "https://jwks.com",
"__tenant": "tenant1",
"__token_issuer": "issuer1",
}
`;

exports[`webAuthOverrides should return overrides if any field is compatible with WebAuth 1`] = `
Object {
"__jwks_uri": "https://jwks.com",
"__tenant": "tenant1",
"__token_issuer": "issuer1",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Object {
"domain": "me.auth0.com",
"leeway": 60,
"overrides": Object {
"__jwks_uri": "https://jwks.com",
"__tenant": "tenant1",
"__token_issuer": "issuer1",
},
Expand Down
15 changes: 13 additions & 2 deletions src/__tests__/core/web_api/helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ import { webAuthOverrides, normalizeError } from 'core/web_api/helper';

describe('webAuthOverrides', () => {
it('should return overrides if any field is compatible with WebAuth', function() {
expect(webAuthOverrides({ __tenant: 'tenant1', __token_issuer: 'issuer1' })).toMatchSnapshot();
expect(
webAuthOverrides({
__tenant: 'tenant1',
__token_issuer: 'issuer1',
__jwks_uri: 'https://jwks.com'
})
).toMatchSnapshot();
});

it('should omit overrides that are not compatible with WebAuth', function() {
expect(
webAuthOverrides({ __tenant: 'tenant1', __token_issuer: 'issuer1', backgroundColor: 'blue' })
webAuthOverrides({
__tenant: 'tenant1',
__token_issuer: 'issuer1',
__jwks_uri: 'https://jwks.com',
backgroundColor: 'blue'
})
).toMatchSnapshot();
});

Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/core/web_api/p2_api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ describe('Auth0APIClient', () => {
leeway: 60,
overrides: {
__tenant: 'tenant1',
__token_issuer: 'issuer1'
__token_issuer: 'issuer1',
__jwks_uri: 'https://jwks.com'
},
plugins: [{ name: 'ExamplePlugin' }],
_telemetryInfo: {}
Expand Down
8 changes: 4 additions & 4 deletions src/core/web_api/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ export function normalizeAuthParams({ popup, popupOptions, ...authParams }) {
return authParams;
}

export function webAuthOverrides({ __tenant, __token_issuer } = {}) {
if (__tenant || __token_issuer) {
export function webAuthOverrides({ __tenant, __token_issuer, __jwks_uri } = {}) {
if (__tenant || __token_issuer || __jwks_uri) {
return {
__tenant,
__token_issuer
__token_issuer,
__jwks_uri
};
}

return null;
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ atob@~1.1.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/atob/-/atob-1.1.3.tgz#95f13629b12c3a51a5d215abdce2aa9f32f80773"

auth0-js@^9.4.1:
version "9.4.1"
resolved "https://registry.yarnpkg.com/auth0-js/-/auth0-js-9.4.1.tgz#a999c30c5566e4c5c7b3e53ed3bc82f4e4344541"
auth0-js@^9.4.2:
version "9.4.2"
resolved "https://registry.yarnpkg.com/auth0-js/-/auth0-js-9.4.2.tgz#44363933266781fb9447ce09503c6f783b86a474"
dependencies:
base64-js "^1.2.0"
idtoken-verifier "^1.2.0"
Expand Down