@okta/okta-auth-js 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/cjs/OktaUserAgent.js +2 -2
- package/dist/okta-auth-js.min.js +1 -1
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.umd.js +1 -1
- package/dist/okta-auth-js.umd.js.map +1 -1
- package/esm/esm.browser.js +16 -115
- package/esm/esm.browser.js.map +1 -1
- package/esm/esm.node.mjs +15 -51
- package/esm/esm.node.mjs.map +1 -1
- package/package.json +4 -4
- package/cjs/options.js +0 -170
- package/cjs/options.js.map +0 -1
- package/lib/options.d.ts +0 -14
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@okta/okta-auth-js",
|
|
4
4
|
"description": "The Okta Auth SDK",
|
|
5
|
-
"version": "6.3.
|
|
5
|
+
"version": "6.3.2",
|
|
6
6
|
"homepage": "https://github.com/okta/okta-auth-js",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "cjs/index.js",
|
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
"okta": {
|
|
190
|
-
"commitSha": "
|
|
191
|
-
"fullVersion": "6.3.
|
|
192
|
-
"testedSha": "
|
|
190
|
+
"commitSha": "d8949fd4d8fa6d87a1966259520b9a239914ec67",
|
|
191
|
+
"fullVersion": "6.3.2-gd8949fd",
|
|
192
|
+
"testedSha": "97c218a35528ea5d2d055953d554d72ce1e71011"
|
|
193
193
|
}
|
|
194
194
|
}
|
package/cjs/options.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.getDefaultOptions = getDefaultOptions;
|
|
6
|
-
exports.buildOptions = buildOptions;
|
|
7
|
-
|
|
8
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
9
|
-
|
|
10
|
-
var _util = require("./util");
|
|
11
|
-
|
|
12
|
-
var _builderUtil = require("./builderUtil");
|
|
13
|
-
|
|
14
|
-
var _fetchRequest = _interopRequireDefault(require("./fetch/fetchRequest"));
|
|
15
|
-
|
|
16
|
-
var _browserStorage = _interopRequireDefault(require("./browser/browserStorage"));
|
|
17
|
-
|
|
18
|
-
var _serverStorage = _interopRequireDefault(require("./server/serverStorage"));
|
|
19
|
-
|
|
20
|
-
var _features = require("./features");
|
|
21
|
-
|
|
22
|
-
/*!
|
|
23
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
24
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
25
|
-
*
|
|
26
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
29
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
-
*
|
|
31
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/* eslint-disable complexity */
|
|
35
|
-
const BROWSER_STORAGE = {
|
|
36
|
-
token: {
|
|
37
|
-
storageTypes: ['localStorage', 'sessionStorage', 'cookie']
|
|
38
|
-
},
|
|
39
|
-
cache: {
|
|
40
|
-
storageTypes: ['localStorage', 'sessionStorage', 'cookie']
|
|
41
|
-
},
|
|
42
|
-
transaction: {
|
|
43
|
-
storageTypes: ['sessionStorage', 'localStorage', 'cookie']
|
|
44
|
-
},
|
|
45
|
-
'shared-transaction': {
|
|
46
|
-
storageTypes: ['localStorage']
|
|
47
|
-
},
|
|
48
|
-
'original-uri': {
|
|
49
|
-
storageTypes: ['localStorage']
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const SERVER_STORAGE = {
|
|
53
|
-
token: {
|
|
54
|
-
storageTypes: ['memory']
|
|
55
|
-
},
|
|
56
|
-
cache: {
|
|
57
|
-
storageTypes: ['memory']
|
|
58
|
-
},
|
|
59
|
-
transaction: {
|
|
60
|
-
storageTypes: ['memory']
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
function getCookieSettings(args = {}, isHTTPS) {
|
|
65
|
-
// Secure cookies will be automatically used on a HTTPS connection
|
|
66
|
-
// Non-secure cookies will be automatically used on a HTTP connection
|
|
67
|
-
// secure option can override the automatic behavior
|
|
68
|
-
var cookieSettings = args.cookies || {};
|
|
69
|
-
|
|
70
|
-
if (typeof cookieSettings.secure === 'undefined') {
|
|
71
|
-
cookieSettings.secure = isHTTPS;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (typeof cookieSettings.sameSite === 'undefined') {
|
|
75
|
-
cookieSettings.sameSite = cookieSettings.secure ? 'none' : 'lax';
|
|
76
|
-
} // If secure=true, but the connection is not HTTPS, set secure=false.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (cookieSettings.secure && !isHTTPS) {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
(0, _util.warn)('The current page is not being served with the HTTPS protocol.\n' + 'For security reasons, we strongly recommend using HTTPS.\n' + 'If you cannot use HTTPS, set "cookies.secure" option to false.');
|
|
82
|
-
cookieSettings.secure = false;
|
|
83
|
-
} // Chrome >= 80 will block cookies with SameSite=None unless they are also Secure
|
|
84
|
-
// If sameSite=none, but the connection is not HTTPS, set sameSite=lax.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (cookieSettings.sameSite === 'none' && !cookieSettings.secure) {
|
|
88
|
-
cookieSettings.sameSite = 'lax';
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return cookieSettings;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function getDefaultOptions() {
|
|
95
|
-
let storageUtil;
|
|
96
|
-
|
|
97
|
-
if ((0, _features.isBrowser)()) {
|
|
98
|
-
storageUtil = (0, _assign.default)({}, _browserStorage.default, {
|
|
99
|
-
inMemoryStore: {} // create unique storage for this instance
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
storageUtil = _serverStorage.default;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const storageManager = (0, _features.isBrowser)() ? BROWSER_STORAGE : SERVER_STORAGE;
|
|
107
|
-
const enableSharedStorage = (0, _features.isBrowser)() ? true : false; // localStorage for multi-tab flows (browser only)
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
devMode: false,
|
|
111
|
-
httpRequestClient: _fetchRequest.default,
|
|
112
|
-
storageUtil,
|
|
113
|
-
storageManager,
|
|
114
|
-
transactionManager: {
|
|
115
|
-
enableSharedStorage
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function mergeOptions(options, args) {
|
|
121
|
-
return (0, _assign.default)({}, options, (0, _util.removeNils)(args), {
|
|
122
|
-
storageManager: (0, _assign.default)({}, options.storageManager, args.storageManager),
|
|
123
|
-
transactionManager: (0, _assign.default)({}, options.transactionManager, args.transactionManager)
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function buildOptions(args = {}) {
|
|
128
|
-
(0, _builderUtil.assertValidConfig)(args);
|
|
129
|
-
args = mergeOptions(getDefaultOptions(), args);
|
|
130
|
-
return (0, _util.removeNils)({
|
|
131
|
-
// OIDC configuration
|
|
132
|
-
issuer: (0, _util.removeTrailingSlash)(args.issuer),
|
|
133
|
-
tokenUrl: (0, _util.removeTrailingSlash)(args.tokenUrl),
|
|
134
|
-
authorizeUrl: (0, _util.removeTrailingSlash)(args.authorizeUrl),
|
|
135
|
-
userinfoUrl: (0, _util.removeTrailingSlash)(args.userinfoUrl),
|
|
136
|
-
revokeUrl: (0, _util.removeTrailingSlash)(args.revokeUrl),
|
|
137
|
-
logoutUrl: (0, _util.removeTrailingSlash)(args.logoutUrl),
|
|
138
|
-
clientId: args.clientId,
|
|
139
|
-
redirectUri: args.redirectUri,
|
|
140
|
-
state: args.state,
|
|
141
|
-
scopes: args.scopes,
|
|
142
|
-
postLogoutRedirectUri: args.postLogoutRedirectUri,
|
|
143
|
-
responseMode: args.responseMode,
|
|
144
|
-
responseType: args.responseType,
|
|
145
|
-
pkce: args.pkce === false ? false : true,
|
|
146
|
-
// PKCE defaults to true
|
|
147
|
-
useInteractionCodeFlow: args.useInteractionCodeFlow,
|
|
148
|
-
// Internal options
|
|
149
|
-
httpRequestClient: args.httpRequestClient,
|
|
150
|
-
transformErrorXHR: args.transformErrorXHR,
|
|
151
|
-
transformAuthState: args.transformAuthState,
|
|
152
|
-
restoreOriginalUri: args.restoreOriginalUri,
|
|
153
|
-
storageUtil: args.storageUtil,
|
|
154
|
-
headers: args.headers,
|
|
155
|
-
devMode: !!args.devMode,
|
|
156
|
-
storageManager: args.storageManager,
|
|
157
|
-
transactionManager: args.transactionManager,
|
|
158
|
-
cookies: (0, _features.isBrowser)() ? getCookieSettings(args, (0, _features.isHTTPS)()) : args.cookies,
|
|
159
|
-
flow: args.flow,
|
|
160
|
-
codeChallenge: args.codeChallenge,
|
|
161
|
-
codeChallengeMethod: args.codeChallengeMethod,
|
|
162
|
-
recoveryToken: args.recoveryToken,
|
|
163
|
-
activationToken: args.activationToken,
|
|
164
|
-
// Give the developer the ability to disable token signature validation.
|
|
165
|
-
ignoreSignature: !!args.ignoreSignature,
|
|
166
|
-
// Server-side web applications
|
|
167
|
-
clientSecret: args.clientSecret
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=options.js.map
|
package/cjs/options.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/options.ts"],"names":["BROWSER_STORAGE","token","storageTypes","cache","transaction","SERVER_STORAGE","getCookieSettings","args","isHTTPS","cookieSettings","cookies","secure","sameSite","getDefaultOptions","storageUtil","browserStorage","inMemoryStore","serverStorage","storageManager","enableSharedStorage","devMode","httpRequestClient","fetchRequest","transactionManager","mergeOptions","options","buildOptions","issuer","tokenUrl","authorizeUrl","userinfoUrl","revokeUrl","logoutUrl","clientId","redirectUri","state","scopes","postLogoutRedirectUri","responseMode","responseType","pkce","useInteractionCodeFlow","transformErrorXHR","transformAuthState","restoreOriginalUri","headers","flow","codeChallenge","codeChallengeMethod","recoveryToken","activationToken","ignoreSignature","clientSecret"],"mappings":";;;;;;;;;AAcA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAUA,MAAMA,eAAsC,GAAG;AAC7CC,EAAAA,KAAK,EAAE;AACLC,IAAAA,YAAY,EAAE,CACZ,cADY,EAEZ,gBAFY,EAGZ,QAHY;AADT,GADsC;AAQ7CC,EAAAA,KAAK,EAAE;AACLD,IAAAA,YAAY,EAAE,CACZ,cADY,EAEZ,gBAFY,EAGZ,QAHY;AADT,GARsC;AAe7CE,EAAAA,WAAW,EAAE;AACXF,IAAAA,YAAY,EAAE,CACZ,gBADY,EAEZ,cAFY,EAGZ,QAHY;AADH,GAfgC;AAsB7C,wBAAsB;AACpBA,IAAAA,YAAY,EAAE,CACZ,cADY;AADM,GAtBuB;AA2B7C,kBAAgB;AACdA,IAAAA,YAAY,EAAE,CACZ,cADY;AADA;AA3B6B,CAA/C;AAkCA,MAAMG,cAAqC,GAAG;AAC5CJ,EAAAA,KAAK,EAAE;AACLC,IAAAA,YAAY,EAAE,CACZ,QADY;AADT,GADqC;AAM5CC,EAAAA,KAAK,EAAE;AACLD,IAAAA,YAAY,EAAE,CACZ,QADY;AADT,GANqC;AAW5CE,EAAAA,WAAW,EAAE;AACXF,IAAAA,YAAY,EAAE,CACZ,QADY;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,IAAI,CAAC4C,eApCR;AAsChB;AACAC,IAAAA,YAAY,EAAE7C,IAAI,CAAC6C;AAvCH,GAAX,CAAP;AAyCD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n/* eslint-disable complexity */\nimport { removeTrailingSlash, warn, removeNils } from './util';\nimport { assertValidConfig } from './builderUtil';\nimport { OktaAuthOptions, StorageManagerOptions } from './types';\n\nimport fetchRequest from './fetch/fetchRequest';\nimport browserStorage from './browser/browserStorage';\nimport serverStorage from './server/serverStorage';\nimport { isBrowser, isHTTPS } from './features';\n\nconst BROWSER_STORAGE: StorageManagerOptions = {\n token: {\n storageTypes: [\n 'localStorage',\n 'sessionStorage',\n 'cookie'\n ]\n },\n cache: {\n storageTypes: [\n 'localStorage',\n 'sessionStorage',\n 'cookie'\n ]\n },\n transaction: {\n storageTypes: [\n 'sessionStorage',\n 'localStorage',\n 'cookie'\n ]\n },\n 'shared-transaction': {\n storageTypes: [\n 'localStorage'\n ]\n },\n 'original-uri': {\n storageTypes: [\n 'localStorage'\n ]\n }\n};\n\nconst SERVER_STORAGE: StorageManagerOptions = {\n token: {\n storageTypes: [\n 'memory'\n ]\n },\n cache: {\n storageTypes: [\n 'memory'\n ]\n },\n transaction: {\n storageTypes: [\n 'memory'\n ]\n }\n};\n\nfunction getCookieSettings(args: OktaAuthOptions = {}, isHTTPS: boolean) {\n // Secure cookies will be automatically used on a HTTPS connection\n // Non-secure cookies will be automatically used on a HTTP connection\n // secure option can override the automatic behavior\n var cookieSettings = args.cookies || {};\n if (typeof cookieSettings.secure === 'undefined') {\n cookieSettings.secure = isHTTPS;\n }\n if (typeof cookieSettings.sameSite === 'undefined') {\n cookieSettings.sameSite = cookieSettings.secure ? 'none' : 'lax';\n }\n\n // If secure=true, but the connection is not HTTPS, set secure=false.\n if (cookieSettings.secure && !isHTTPS) {\n // eslint-disable-next-line no-console\n warn(\n 'The current page is not being served with the HTTPS protocol.\\n' +\n 'For security reasons, we strongly recommend using HTTPS.\\n' +\n 'If you cannot use HTTPS, set \"cookies.secure\" option to false.'\n );\n cookieSettings.secure = false;\n }\n\n // Chrome >= 80 will block cookies with SameSite=None unless they are also Secure\n // If sameSite=none, but the connection is not HTTPS, set sameSite=lax.\n if (cookieSettings.sameSite === 'none' && !cookieSettings.secure) {\n cookieSettings.sameSite = 'lax';\n }\n\n return cookieSettings;\n}\n\n\nexport function getDefaultOptions(): OktaAuthOptions {\n let storageUtil;\n if (isBrowser()) {\n storageUtil = Object.assign({}, browserStorage, {\n inMemoryStore: {} // create unique storage for this instance\n });\n } else {\n storageUtil = serverStorage;\n }\n const storageManager = isBrowser() ? BROWSER_STORAGE : SERVER_STORAGE;\n const enableSharedStorage = isBrowser() ? true : false; // localStorage for multi-tab flows (browser only)\n return {\n devMode: false,\n httpRequestClient: fetchRequest,\n storageUtil,\n storageManager,\n transactionManager: {\n enableSharedStorage\n }\n };\n}\n\nfunction mergeOptions(options, args): OktaAuthOptions {\n return Object.assign({}, options, removeNils(args), {\n storageManager: Object.assign({}, options.storageManager, args.storageManager),\n transactionManager: Object.assign({}, options.transactionManager, args.transactionManager),\n });\n}\n\nexport function buildOptions(args: OktaAuthOptions = {}): OktaAuthOptions {\n assertValidConfig(args);\n args = mergeOptions(getDefaultOptions(), args);\n return removeNils({\n // OIDC configuration\n issuer: removeTrailingSlash(args.issuer),\n tokenUrl: removeTrailingSlash(args.tokenUrl),\n authorizeUrl: removeTrailingSlash(args.authorizeUrl),\n userinfoUrl: removeTrailingSlash(args.userinfoUrl),\n revokeUrl: removeTrailingSlash(args.revokeUrl),\n logoutUrl: removeTrailingSlash(args.logoutUrl),\n clientId: args.clientId,\n redirectUri: args.redirectUri,\n state: args.state,\n scopes: args.scopes,\n postLogoutRedirectUri: args.postLogoutRedirectUri,\n responseMode: args.responseMode,\n responseType: args.responseType,\n pkce: args.pkce === false ? false : true, // PKCE defaults to true\n useInteractionCodeFlow: args.useInteractionCodeFlow,\n\n // Internal options\n httpRequestClient: args.httpRequestClient,\n transformErrorXHR: args.transformErrorXHR,\n transformAuthState: args.transformAuthState,\n restoreOriginalUri: args.restoreOriginalUri,\n storageUtil: args.storageUtil,\n headers: args.headers,\n devMode: !!args.devMode,\n storageManager: args.storageManager,\n transactionManager: args.transactionManager,\n cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,\n flow: args.flow,\n codeChallenge: args.codeChallenge,\n codeChallengeMethod: args.codeChallengeMethod,\n recoveryToken: args.recoveryToken,\n activationToken: args.activationToken,\n \n // Give the developer the ability to disable token signature validation.\n ignoreSignature: !!args.ignoreSignature,\n\n // Server-side web applications\n clientSecret: args.clientSecret\n });\n}\n"],"file":"options.js"}
|
package/lib/options.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { OktaAuthOptions } from './types';
|
|
13
|
-
export declare function getDefaultOptions(): OktaAuthOptions;
|
|
14
|
-
export declare function buildOptions(args?: OktaAuthOptions): OktaAuthOptions;
|