Skip to content

Commit

Permalink
Set the default token validation leeway to 60 sec (auth0#1770)
Browse files Browse the repository at this point in the history
* Bumped auth0-js to 9.12.1

* Update default leeway to 60 sec
  • Loading branch information
Steve Hobbs authored and jfromaniello committed Jul 23, 2020
1 parent b6e481f commit 0bbaada
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"zuul-ngrok": "4.0.0"
},
"dependencies": {
"auth0-js": "^9.12.0",
"auth0-js": "^9.12.1",
"auth0-password-policies": "^1.0.2",
"blueimp-md5": "2.3.1",
"immutable": "^3.7.3",
Expand Down
33 changes: 33 additions & 0 deletions src/__tests__/core/web_api/__snapshots__/p2_api.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,39 @@ Object {
`;

exports[`Auth0APIClient init with overrides forwards options to WebAuth 1`] = `
Object {
"_sendTelemetry": true,
"_telemetryInfo": Object {
"env": Object {
"auth0.js": "a0js.version",
},
"name": "lock.js",
"version": "lock.version",
},
"audience": "foo",
"clientID": "cid",
"domain": "me.auth0.com",
"leeway": 30,
"nonce": "nonce",
"overrides": Object {
"__jwks_uri": "https://jwks.com",
"__tenant": "tenant1",
"__token_issuer": "issuer1",
},
"plugins": Array [
Object {
"name": "ExamplePlugin",
},
],
"redirectUri": "//localhost:8080/login/callback",
"responseMode": "query",
"responseType": "code",
"scope": "custom_scope",
"state": "state",
}
`;

exports[`Auth0APIClient init with overrides forwards options to WebAuth with a default leeway 1`] = `
Object {
"_sendTelemetry": true,
"_telemetryInfo": Object {
Expand Down
36 changes: 32 additions & 4 deletions src/__tests__/core/web_api/p2_api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Auth0APIClient', () => {
redirectUrl: '//localhost:8080/login/callback',
responseMode: 'query',
responseType: 'code',
leeway: 60,
leeway: 30,
_telemetryInfo: { ignored: true }
};
getClient(options);
Expand All @@ -61,7 +61,7 @@ describe('Auth0APIClient', () => {
redirectUrl: '//localhost:8080/login/callback',
responseMode: 'query',
responseType: 'code',
leeway: 60,
leeway: 30,
_telemetryInfo: { name: 'test-sdk', version: '1.0.0', env: { envOverride: true } }
};
getClient(options);
Expand All @@ -82,7 +82,7 @@ describe('Auth0APIClient', () => {
redirectUrl: '//localhost:8080/login/callback',
responseMode: 'query',
responseType: 'code',
leeway: 60,
leeway: 30,
_telemetryInfo: {
name: 'test-sdk',
version: '1.0.0',
Expand All @@ -109,7 +109,35 @@ describe('Auth0APIClient', () => {
redirectUrl: '//localhost:8080/login/callback',
responseMode: 'query',
responseType: 'code',
leeway: 60,
leeway: 30,
overrides: {
__tenant: 'tenant1',
__token_issuer: 'issuer1',
__jwks_uri: 'https://jwks.com'
},
plugins: [
{
name: 'ExamplePlugin'
}
],
params: {
nonce: 'nonce',
state: 'state',
scope: 'custom_scope'
}
};
const client = getClient(options);
const mock = getAuth0ClientMock();
expect(mock.WebAuth.mock.calls[0][0]).toMatchSnapshot();
});

it('forwards options to WebAuth with a default leeway', () => {
setURL(`https://auth.myapp.com/authorize`);
const options = {
audience: 'foo',
redirectUrl: '//localhost:8080/login/callback',
responseMode: 'query',
responseType: 'code',
overrides: {
__tenant: 'tenant1',
__token_issuer: 'issuer1',
Expand Down
2 changes: 1 addition & 1 deletion src/core/web_api/p2_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Auth0APIClient {
redirectUri: opts.redirectUrl,
responseMode: opts.responseMode,
responseType: opts.responseType,
leeway: opts.leeway || 1,
leeway: opts.leeway || 60,
plugins: opts.plugins || [new CordovaAuth0Plugin()],
overrides: webAuthOverrides(opts.overrides),
_sendTelemetry: opts._sendTelemetry === false ? false : true,
Expand Down
73 changes: 52 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ atob@^2.1.1:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==

auth0-js@^9.12.0:
version "9.12.0"
resolved "https://registry.yarnpkg.com/auth0-js/-/auth0-js-9.12.0.tgz#6b8ac52767382366b1f81d85e394329174c54dc3"
integrity sha512-OnI04ISKF7SGOlP8MFqnVUNPwVaceynwkjA6f55z2CsZaUXynTTiTtGRhyU2c88kR4skPx1si0SKowzzy38+aw==
auth0-js@^9.12.1:
version "9.12.1"
resolved "https://registry.yarnpkg.com/auth0-js/-/auth0-js-9.12.1.tgz#ffe76acdbd66ad61a0a71c818d69a599c8228937"
integrity sha512-0BqClX8iRYWeX8lM6V1h9Yg0ZSxs+naM+dMiknfdwr8g7HNLEXqRc1Wx4iZUJfF4PTU5pDksRkiWvjDFQbt2SA==
dependencies:
base64-js "^1.3.0"
idtoken-verifier "^2.0.0"
Expand Down Expand Up @@ -4408,10 +4408,10 @@ forever-agent@~0.6.1:
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=

form-data@^2.3.1, form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==
form-data@^2.3.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4"
integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
Expand All @@ -4435,6 +4435,15 @@ form-data@~0.1.0:
combined-stream "~0.0.4"
mime "~1.2.11"

form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"

formatio@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.1.1.tgz#5ed3ccd636551097383465d996199100e86161e9"
Expand Down Expand Up @@ -5365,7 +5374,7 @@ inherits@1:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b"
integrity sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=

inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
Expand All @@ -5375,6 +5384,11 @@ inherits@2.0.1:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=

inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==

ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
Expand Down Expand Up @@ -6245,9 +6259,9 @@ js-base64@^2.1.9:
integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==

js-cookie@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.0.tgz#1b2c279a6eece380a12168b92485265b35b1effb"
integrity sha1-Gywnmm7s44ChIWi5JIUmWzWx7/s=
version "2.2.1"
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
Expand Down Expand Up @@ -7067,18 +7081,30 @@ mime-db@1.40.0, "mime-db@>= 1.40.0 < 2":
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32"
integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==

mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.6:
version "2.1.24"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81"
integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==
mime-db@1.42.0:
version "1.42.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac"
integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==

mime-types@^2.1.12:
version "2.1.25"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437"
integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==
dependencies:
mime-db "1.40.0"
mime-db "1.42.0"

mime-types@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-1.0.2.tgz#995ae1392ab8affcbfcb2641dd054e943c0d5dce"
integrity sha1-mVrhOSq4r/y/yyZB3QVOlDwNXc4=

mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.6:
version "2.1.24"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81"
integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==
dependencies:
mime-db "1.40.0"

mime@1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.5.tgz#9eed073022a8bf5e16c8566c6867b8832bfbfa13"
Expand Down Expand Up @@ -8609,9 +8635,9 @@ process-nextick-args@~1.0.6:
integrity sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=

process-nextick-args@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==
version "2.0.1"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==

process@^0.11.10, process@~0.11.0:
version "0.11.10"
Expand Down Expand Up @@ -8759,11 +8785,16 @@ qs@2.4.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-2.4.2.tgz#f7ce788e5777df0b5010da7f7c4e73ba32470f5a"
integrity sha1-9854jld33wtQENp/fE5zujJHD1o=

qs@6.7.0, qs@^6.5.1, qs@^6.7.0:
qs@6.7.0, qs@^6.7.0:
version "6.7.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==

qs@^6.5.1:
version "6.9.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.1.tgz#20082c65cb78223635ab1a9eaca8875a29bf8ec9"
integrity sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==

qs@~1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-1.2.2.tgz#19b57ff24dc2a99ce1f8bdf6afcda59f8ef61f88"
Expand Down

0 comments on commit 0bbaada

Please sign in to comment.