@okta/spa-platform 0.6.0 → 0.9.0
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/README.md +204 -0
- package/claude.md +562 -0
- package/dist/esm/Credential/Credential.js.map +1 -1
- package/dist/esm/Credential/CredentialCoordinator.js +25 -22
- package/dist/esm/Credential/CredentialCoordinator.js.map +1 -1
- package/dist/esm/Credential/TokenStorage.js +19 -3
- package/dist/esm/Credential/TokenStorage.js.map +1 -1
- package/dist/esm/FetchClient/index.js.map +1 -1
- package/dist/esm/core.js +25 -0
- package/dist/esm/core.js.map +1 -0
- package/dist/esm/flows/AuthorizationCodeFlow.js.map +1 -1
- package/dist/esm/flows/SessionLogoutFlow.js.map +1 -1
- package/dist/esm/flows/TransactionStorage.js.map +1 -1
- package/dist/esm/flows.js +30 -0
- package/dist/esm/flows.js.map +1 -0
- package/dist/esm/index.js +4 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/orchestrators/AuthorizationCodeFlowOrchestrator.js +4 -0
- package/dist/esm/orchestrators/AuthorizationCodeFlowOrchestrator.js.map +1 -1
- package/dist/esm/orchestrators/HostOrchestrator/Host.js +9 -1
- package/dist/esm/orchestrators/HostOrchestrator/Host.js.map +1 -1
- package/dist/esm/orchestrators/HostOrchestrator/OrchestrationBridge.js.map +1 -1
- package/dist/esm/orchestrators/HostOrchestrator/SubApp.js +8 -2
- package/dist/esm/orchestrators/HostOrchestrator/SubApp.js.map +1 -1
- package/dist/esm/orchestrators/HostOrchestrator/index.js +11 -6
- package/dist/esm/orchestrators/HostOrchestrator/index.js.map +1 -1
- package/dist/esm/platform/OAuth2Client.js +4 -7
- package/dist/esm/platform/OAuth2Client.js.map +1 -1
- package/dist/esm/platform/defaults.js.map +1 -1
- package/dist/esm/platform/index.js.map +1 -1
- package/dist/esm/utils/IndexedDBStore.js +27 -18
- package/dist/esm/utils/IndexedDBStore.js.map +1 -1
- package/dist/esm/utils/SynchronizedResult.js +53 -60
- package/dist/esm/utils/SynchronizedResult.js.map +1 -1
- package/dist/esm/utils/isModernBrowser.js.map +1 -1
- package/dist/types/Credential/Credential.d.ts +8 -2
- package/dist/types/Credential/TokenStorage.d.ts +25 -1
- package/dist/types/FetchClient/index.d.ts +6 -0
- package/dist/types/core.d.ts +19 -0
- package/dist/types/flows/AuthorizationCodeFlow.d.ts +63 -13
- package/dist/types/flows/SessionLogoutFlow.d.ts +24 -0
- package/dist/types/flows/TransactionStorage.d.ts +7 -0
- package/dist/types/flows/index.d.ts +15 -2
- package/dist/types/flows.d.ts +9 -0
- package/dist/types/index.d.ts +1 -14
- package/dist/types/orchestrators/AuthorizationCodeFlowOrchestrator.d.ts +40 -6
- package/dist/types/orchestrators/HostOrchestrator/Host.d.ts +15 -0
- package/dist/types/orchestrators/HostOrchestrator/OrchestrationBridge.d.ts +4 -0
- package/dist/types/orchestrators/HostOrchestrator/SubApp.d.ts +13 -2
- package/dist/types/orchestrators/HostOrchestrator/index.d.ts +50 -16
- package/dist/types/orchestrators/index.d.ts +4 -1
- package/dist/types/platform/OAuth2Client.d.ts +9 -3
- package/dist/types/platform/defaults.d.ts +8 -0
- package/dist/types/platform/index.d.ts +6 -0
- package/dist/types/utils/IndexedDBStore.d.ts +1 -0
- package/dist/types/utils/SynchronizedResult.d.ts +1 -8
- package/dist/types/utils/isModernBrowser.d.ts +2 -1
- package/package.json +1 -1
|
@@ -12,83 +12,76 @@
|
|
|
12
12
|
|
|
13
13
|
const defaultOptions = {
|
|
14
14
|
timeout: 8000,
|
|
15
|
-
lockFreedDelay: 500,
|
|
16
|
-
retries: 2,
|
|
17
15
|
};
|
|
18
|
-
function sleep(ms) {
|
|
19
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
20
|
-
}
|
|
21
16
|
class SynchronizedResult {
|
|
22
17
|
name;
|
|
23
18
|
task;
|
|
24
19
|
channel;
|
|
25
|
-
options
|
|
20
|
+
options;
|
|
26
21
|
constructor(name, task, options = {}) {
|
|
27
22
|
this.name = name;
|
|
28
23
|
this.task = task;
|
|
29
24
|
this.channel = new BroadcastChannel(name);
|
|
30
25
|
this.options = { ...defaultOptions, ...options };
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
const { deseralizer } = this.options;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return 'TIMEOUT';
|
|
49
|
-
}
|
|
50
|
-
async whenLockIsTaken() {
|
|
51
|
-
const { retries } = this.options;
|
|
52
|
-
const result = await Promise.race([
|
|
53
|
-
this.onResultFromOtherTab(),
|
|
54
|
-
this.onLockFreedPlusDelay(),
|
|
55
|
-
this.onTimeout()
|
|
56
|
-
]);
|
|
57
|
-
this.channel.onmessage = () => { };
|
|
58
|
-
if (result === 'FREED' || result === 'TIMEOUT') {
|
|
59
|
-
if (retries > 0) {
|
|
60
|
-
return this.exec();
|
|
27
|
+
async exec() {
|
|
28
|
+
const { seralizer, deseralizer, timeout } = this.options;
|
|
29
|
+
let settled = false;
|
|
30
|
+
let resolve;
|
|
31
|
+
let reject;
|
|
32
|
+
const result = new Promise((res, rej) => { resolve = res; reject = rej; });
|
|
33
|
+
const controller = new AbortController();
|
|
34
|
+
this.channel.onmessage = (event) => {
|
|
35
|
+
if (settled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
settled = true;
|
|
39
|
+
controller.abort();
|
|
40
|
+
const envelope = event.data;
|
|
41
|
+
if (envelope.ok) {
|
|
42
|
+
resolve(deseralizer ? deseralizer(envelope.value) : envelope.value);
|
|
61
43
|
}
|
|
62
44
|
else {
|
|
63
|
-
|
|
45
|
+
reject(new Error(envelope.error));
|
|
64
46
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
async exec(overrides = {}) {
|
|
82
|
-
this.options = { ...this.options, ...overrides };
|
|
83
|
-
try {
|
|
84
|
-
return await navigator.locks.request(this.name, { ifAvailable: true }, async (lock) => {
|
|
85
|
-
if (!lock) {
|
|
86
|
-
return this.whenLockIsTaken();
|
|
47
|
+
};
|
|
48
|
+
const timer = setTimeout(() => {
|
|
49
|
+
if (!settled) {
|
|
50
|
+
settled = true;
|
|
51
|
+
reject(new Error('Task was unable to fulfill'));
|
|
52
|
+
}
|
|
53
|
+
}, timeout);
|
|
54
|
+
navigator.locks.request(this.name, { signal: controller.signal }, async () => {
|
|
55
|
+
if (settled) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const value = await this.task();
|
|
60
|
+
if (!settled) {
|
|
61
|
+
settled = true;
|
|
62
|
+
resolve(value);
|
|
87
63
|
}
|
|
88
|
-
|
|
89
|
-
|
|
64
|
+
this.channel.postMessage({
|
|
65
|
+
ok: true,
|
|
66
|
+
value: seralizer ? seralizer(value) : value
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
if (!settled) {
|
|
71
|
+
settled = true;
|
|
72
|
+
reject(err);
|
|
73
|
+
}
|
|
74
|
+
this.channel.postMessage({
|
|
75
|
+
ok: false,
|
|
76
|
+
error: err instanceof Error ? err.message : String(err)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}).catch(() => { });
|
|
80
|
+
try {
|
|
81
|
+
return await result;
|
|
90
82
|
}
|
|
91
83
|
finally {
|
|
84
|
+
clearTimeout(timer);
|
|
92
85
|
this.close();
|
|
93
86
|
}
|
|
94
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynchronizedResult.js","sources":["../../../../src/utils/SynchronizedResult.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SynchronizedResult.js","sources":["../../../../src/utils/SynchronizedResult.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAeA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,cAAc,CAAA,CAAA,CAA8B,CAAA;AAChD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,EAAE,CAAA,CAAA,CAAA,CAAI,CAAA;CACd,CAAA;MAeY,kBAAkB,CAAA,CAAA;AACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA;AACL,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA;AACJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA;AACP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA;AAEf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAY,CAAA,CAAE,IAAsB,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAoD,CAAA,CAAE,CAAA,CAAA,CAAA;AACvG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,CAAA;AAChB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,CAAA;QAChB,CAAA,CAAA,CA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,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isModernBrowser.js","sources":["../../../../src/utils/isModernBrowser.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"isModernBrowser.js","sources":["../../../../src/utils/isModernBrowser.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;SAWgB,eAAe,CAAA,CAAA,CAAA,CAAA;AAC7B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA;AAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA;AACvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAA,CAAA,CAAA;QAChB,eAAe,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MACnB,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAI,CAAA;IACb,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA;AACd,CAAA;;"}
|
|
@@ -4,14 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Credential as CredentialBase, type RequestAuthorizer, type JSONSerializable } from '@okta/auth-foundation/core';
|
|
6
6
|
/**
|
|
7
|
-
* A browser-specific
|
|
7
|
+
* A browser-specific extension of `@okta/auth-foundation` {@link AuthFoundation!Credential | Credential}
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Uses {@link BroadcastChannel} to synchronize tokens across tabs. In testing environments, it may be
|
|
11
|
+
* required to use {@link Credential.close} to prevent open handles.
|
|
8
12
|
*
|
|
9
13
|
* @group Credential
|
|
10
14
|
* @noInheritDoc
|
|
15
|
+
*
|
|
16
|
+
* @see Base Class: {@link AuthFoundation!Credential | Credential}
|
|
11
17
|
*/
|
|
12
18
|
export declare class Credential extends CredentialBase implements RequestAuthorizer, JSONSerializable {
|
|
13
19
|
/**
|
|
14
|
-
* Closes the underlying BroadcastChannel, useful for testing environments to avoid open handles
|
|
20
|
+
* Closes the underlying {@link BroadcastChannel}, useful for testing environments to avoid open handles
|
|
15
21
|
*
|
|
16
22
|
* @see
|
|
17
23
|
* {@link https://jestjs.io/docs/cli#--detectopenhandles | jest --detectOpenHandles}
|
|
@@ -5,16 +5,35 @@
|
|
|
5
5
|
import { Token, type TokenStorage, type TokenStorageEvents, EventEmitter } from '@okta/auth-foundation/core';
|
|
6
6
|
import { IndexedDBStore } from '../utils/IndexedDBStore.ts';
|
|
7
7
|
/**
|
|
8
|
-
* Default implementation of TokenStorage backend by
|
|
8
|
+
* Default implementation of {@link TokenStorage} backend by {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage | localStorage}
|
|
9
|
+
*
|
|
10
|
+
* By default, all tokens will be encrypted (via `AES-GCM`) before being written to storage. {@link Token.Metadata} is stored separately an unencrypted.
|
|
11
|
+
* This enables storage queries (via {@link AuthFoundation!Credential.find | Credential.find}) to search on claims without decrypting tokens
|
|
12
|
+
*
|
|
9
13
|
* @internal
|
|
10
14
|
*/
|
|
11
15
|
export declare class BrowserTokenStorage implements TokenStorage {
|
|
12
16
|
#private;
|
|
13
17
|
private static version;
|
|
18
|
+
/**
|
|
19
|
+
* A storage key prefix to identify entries by
|
|
20
|
+
*/
|
|
14
21
|
tokenPrefix: string;
|
|
22
|
+
/**
|
|
23
|
+
* A {@link IndexedDB}-based store for the storage encryption key(s)
|
|
24
|
+
*/
|
|
15
25
|
encryptionKeyStore: IndexedDBStore<CryptoKey>;
|
|
26
|
+
/**
|
|
27
|
+
* Key name for the encryption key within the {@link encryptionKeyStore}
|
|
28
|
+
*/
|
|
16
29
|
encryptionKeyName: string;
|
|
30
|
+
/**
|
|
31
|
+
* When `true`, includes `idToken` claims in stored {@link Token.Metadata}. Metadata is stored separately
|
|
32
|
+
*/
|
|
17
33
|
includeClaims: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* When `true`, tokens will be encrypted (via `AES-GCM`) before being written to storage.
|
|
36
|
+
*/
|
|
18
37
|
encryptAtRest: boolean;
|
|
19
38
|
supportLegacyStructure: boolean;
|
|
20
39
|
readonly emitter: EventEmitter<TokenStorageEvents>;
|
|
@@ -23,6 +42,7 @@ export declare class BrowserTokenStorage implements TokenStorage {
|
|
|
23
42
|
get defaultTokenId(): string | null;
|
|
24
43
|
protected idToStoreKey(id: string): string;
|
|
25
44
|
protected legacyStoreKey(id: string): string;
|
|
45
|
+
loadDefaultTokenId(): Promise<string | null>;
|
|
26
46
|
setDefaultTokenId(id: string | null): Promise<void>;
|
|
27
47
|
private saveDefault;
|
|
28
48
|
allIDs(): Promise<string[]>;
|
|
@@ -40,6 +60,10 @@ export declare class BrowserTokenStorage implements TokenStorage {
|
|
|
40
60
|
token: any;
|
|
41
61
|
metadata: any;
|
|
42
62
|
} | null;
|
|
63
|
+
/**
|
|
64
|
+
* Call to remove a corrupted entry for storage
|
|
65
|
+
*/
|
|
66
|
+
private removeCorruptedEntry;
|
|
43
67
|
/**
|
|
44
68
|
* Handles errors thrown when reading a token from storage
|
|
45
69
|
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* NOTE: DO NOT INCLUDE ANY FILES WHICH DEPEND ON `@okta/oauth2-flows`
|
|
6
|
+
*/
|
|
7
|
+
export * from '@okta/auth-foundation/core';
|
|
8
|
+
export * from './platform/defaults.ts';
|
|
9
|
+
export { Credential } from './Credential/Credential.ts';
|
|
10
|
+
export { CredentialCoordinatorImpl } from './Credential/CredentialCoordinator.ts';
|
|
11
|
+
export { BrowserTokenStorage } from './Credential/TokenStorage.ts';
|
|
12
|
+
export { DefaultCredentialDataSource } from './Credential/CredentialDataSource.ts';
|
|
13
|
+
export { FetchClient } from './FetchClient/index.ts';
|
|
14
|
+
export * from './orchestrators/HostOrchestrator/index.ts';
|
|
15
|
+
export { DefaultSigningAuthority } from './platform/dpop/authority.ts';
|
|
16
|
+
export { clearDPoPKeyPairs } from './platform/index.ts';
|
|
17
|
+
export { PersistentCache } from './platform/dpop/nonceCache.ts';
|
|
18
|
+
export { OAuth2Client } from './platform/OAuth2Client.ts';
|
|
19
|
+
export * from './utils/isModernBrowser.ts';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @mergeModuleWith Flows
|
|
4
|
+
*/
|
|
1
5
|
import { type OAuth2ErrorResponse } from '@okta/auth-foundation/core';
|
|
2
6
|
import { AuthorizationCodeFlow as AuthorizationCodeFlowBase } from '@okta/oauth2-flows';
|
|
3
7
|
/** @internal */
|
|
@@ -8,6 +12,11 @@ type PostMessageListenerOptions = {
|
|
|
8
12
|
};
|
|
9
13
|
/** @internal */
|
|
10
14
|
declare function bindOktaPostMessageListener({ state, expectedOrigin, timeout }: PostMessageListenerOptions): Promise<AuthorizationCodeFlow.RedirectValues | OAuth2ErrorResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Browser-specific additions to {@link OAuth2Flows!AuthorizationCodeFlow | AuthorizationCodeFlow}
|
|
17
|
+
*
|
|
18
|
+
* @noInheritDoc
|
|
19
|
+
*/
|
|
11
20
|
export declare class AuthorizationCodeFlow extends AuthorizationCodeFlowBase {
|
|
12
21
|
/**
|
|
13
22
|
* Performs a browser full-page redirect to the `Authorization Server` `/authorize` endpoint.
|
|
@@ -19,7 +28,8 @@ export declare class AuthorizationCodeFlow extends AuthorizationCodeFlowBase {
|
|
|
19
28
|
* This method returns a `Promise` that will never fulfill; a browser redirect will occur first
|
|
20
29
|
*
|
|
21
30
|
* @see
|
|
22
|
-
* {@link AuthorizationCodeFlow.resume}
|
|
31
|
+
* * {@link AuthorizationCodeFlow.resume}
|
|
32
|
+
* * [SPA Platform: PerformRedirect](/api/spa-platform/#performredirect)
|
|
23
33
|
*/
|
|
24
34
|
static PerformRedirect(flow: AuthorizationCodeFlow): Promise<void>;
|
|
25
35
|
/** @internal */
|
|
@@ -40,32 +50,35 @@ export declare class AuthorizationCodeFlow extends AuthorizationCodeFlowBase {
|
|
|
40
50
|
* Use {@link AuthorizationCodeFlow.PerformRedirect} instead
|
|
41
51
|
*
|
|
42
52
|
* @returns
|
|
43
|
-
* Returns a {@link
|
|
53
|
+
* Returns a {@link AuthFoundation!Token | Token} and the {@link AuthorizationCodeFlow.Context} used to request the token
|
|
44
54
|
*
|
|
45
55
|
* @see
|
|
46
56
|
* - {@link https://auth0.com/docs/authenticate/login/configure-silent-authentication | Silent Authentication}
|
|
47
57
|
* - {@link https://developers.google.com/privacy-sandbox/cookies | Third-party Cookie Deprecation}
|
|
58
|
+
* - [SPA Platform: PerformSilently](/api/spa-platform/#performsilently)
|
|
48
59
|
*/
|
|
49
60
|
static PerformSilently(flow: AuthorizationCodeFlow): Promise<AuthorizationCodeFlow.Result>;
|
|
50
61
|
/**
|
|
51
|
-
*
|
|
62
|
+
* > [!IMPORTANT]
|
|
63
|
+
* > Read carefully before use. This method (and popup pattern at large) has quite a few "gotchas"
|
|
52
64
|
*
|
|
53
65
|
* Fulfills `/authorize` requests in a popup window. Not necessarily recommended for primary authentication flows,
|
|
54
|
-
* but can be useful for step up authentication flows.
|
|
66
|
+
* but can be useful for step up authentication flows against a known IDP.
|
|
55
67
|
*
|
|
56
|
-
*
|
|
68
|
+
* > [!NOTE]
|
|
69
|
+
* > The phrase "external IDP" refers to an IDP other than the configured `issuer` for a given flow. See
|
|
70
|
+
* > [Concepts: External Identity Providers](https://developer.okta.com/docs/concepts/identity-providers/) for a more detailed explanation
|
|
57
71
|
*
|
|
58
|
-
* @remarks
|
|
59
72
|
* Utilizing external IDPs in a popup window may be susceptible to the IDP's `Cross-Origin-Opener-Policy`. Depending on their policy value,
|
|
60
|
-
*
|
|
73
|
+
* loading the IDP in a popup window may cause the popup window to create a new browsing context group (BCG), seperate from the main
|
|
61
74
|
* browser window. The authentication flow will be unable to complete if this occurs. It's recommended to avoid using this method (and a popup
|
|
62
75
|
* in general) when utilizing external IDPs.
|
|
63
76
|
*
|
|
64
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy | Cross-Origin-Opener-Policy}
|
|
65
|
-
* {@link https://developer.mozilla.org/en-US/docs/Glossary/Browsing_context | Browsing Context Group}
|
|
77
|
+
* * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy | Cross-Origin-Opener-Policy}
|
|
78
|
+
* * {@link https://developer.mozilla.org/en-US/docs/Glossary/Browsing_context | Browsing Context Group}
|
|
66
79
|
*
|
|
80
|
+
* @group Authorize Methods
|
|
67
81
|
* @param flow - instance of {@link AuthorizationCodeFlow} to be used
|
|
68
|
-
*
|
|
69
82
|
* @param popupWindow - Optionally, a `Window` object (representing a popup window) can be provided.
|
|
70
83
|
* Providing a popup reference can be useful when control over the popup's attributes, like name and size, is required.
|
|
71
84
|
*
|
|
@@ -73,18 +86,55 @@ export declare class AuthorizationCodeFlow extends AuthorizationCodeFlowBase {
|
|
|
73
86
|
* can block popups spawned from `async` processes. Loading the base route before navigating to `/authorize` helps reduce the likelihood
|
|
74
87
|
* the popup gets blocked. To override this behavior, provide a popup reference
|
|
75
88
|
*
|
|
76
|
-
* @returns
|
|
77
|
-
*
|
|
78
|
-
*
|
|
89
|
+
* @returns
|
|
90
|
+
* Success response:
|
|
91
|
+
* | Property | Type | Description |
|
|
92
|
+
* | ------ | ------ | ------ |
|
|
93
|
+
* | `completed` | `true` | Indicates the flow completed successfully |
|
|
94
|
+
* | `token` | {@link AuthFoundation!Token | Token} | The resulting token from the successful flow |
|
|
95
|
+
* | `context` | `Record<string, any>` | Developer-provided (pre-auth) metadata about the token |
|
|
96
|
+
*
|
|
97
|
+
* Unsuccessful response:
|
|
98
|
+
* | Property | Type | Description |
|
|
99
|
+
* | ------ | ------ | ------ |
|
|
100
|
+
* | `completed` | `false` | Indicates the flow **did not** complete |
|
|
101
|
+
* | `reason` | `'closed'` or `'blocked'` | Indicates the _reason_ the flow did not complete |
|
|
102
|
+
*
|
|
79
103
|
* - `'closed'` indicates the user manually closed the popup window
|
|
80
104
|
* - `'blocked'` indicates the popup window was unable to be opened (presumably by a popup blocker or browser heustistics)
|
|
105
|
+
*
|
|
106
|
+
* @see
|
|
107
|
+
* - [SPA Platform: PerformInPopup](/api/spa-platform/#performinpopup)
|
|
81
108
|
*/
|
|
82
109
|
static PerformInPopup(flow: AuthorizationCodeFlow, popupWindow?: Window): Promise<AuthorizationCodeFlow.PopupResult>;
|
|
83
110
|
}
|
|
111
|
+
/** {@inheritDoc AuthorizationCodeFlow} */
|
|
84
112
|
export declare namespace AuthorizationCodeFlow {
|
|
113
|
+
/** @reexport */
|
|
85
114
|
type RedirectValues = AuthorizationCodeFlowBase.RedirectValues;
|
|
115
|
+
/** @reexport */
|
|
86
116
|
type Result = AuthorizationCodeFlowBase.Result;
|
|
117
|
+
/** @reexport */
|
|
87
118
|
type Context = AuthorizationCodeFlowBase.Context;
|
|
119
|
+
/**
|
|
120
|
+
* The possible results from {@link AuthorizationCodeFlow.PerformInPopup}
|
|
121
|
+
*
|
|
122
|
+
* Success response:
|
|
123
|
+
* | Property | Type | Description |
|
|
124
|
+
* | ------ | ------ | ------ |
|
|
125
|
+
* | `completed` | `true` | Indicates the flow completed successfully |
|
|
126
|
+
* | `token` | {@link AuthFoundation!Token | Token} | The resulting token from the successful flow |
|
|
127
|
+
* | `context` | `Record<string, any>` | Developer-provided (pre-auth) metadata about the token |
|
|
128
|
+
*
|
|
129
|
+
* Unsuccessful response:
|
|
130
|
+
* | Property | Type | Description |
|
|
131
|
+
* | ------ | ------ | ------ |
|
|
132
|
+
* | `completed` | `false` | Indicates the flow **did not** complete |
|
|
133
|
+
* | `reason` | `'closed'` or `'blocked'` | Indicates the _reason_ the flow did not complete |
|
|
134
|
+
*
|
|
135
|
+
* - `'closed'` indicates the user manually closed the popup window
|
|
136
|
+
* - `'blocked'` indicates the popup window was unable to be opened (presumably by a popup blocker or browser heustistics)
|
|
137
|
+
*/
|
|
88
138
|
type PopupResult = (Result & {
|
|
89
139
|
completed: true;
|
|
90
140
|
}) | {
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @mergeModuleWith Flows
|
|
4
|
+
*/
|
|
1
5
|
import { SessionLogoutFlow as SessionLogoutFlowBase } from '@okta/oauth2-flows';
|
|
6
|
+
/**
|
|
7
|
+
* Browser-specific additions to {@link OAuth2Flows!SessionLogoutFlow | SessionLogoutFlow} to perform OIDC logout
|
|
8
|
+
*
|
|
9
|
+
* @see
|
|
10
|
+
* * {@link https://openid.net/specs/openid-connect-rpinitiated-1_0.html | OIDC RP-Initiated Logout}
|
|
11
|
+
*
|
|
12
|
+
* @noInheritDoc
|
|
13
|
+
*/
|
|
2
14
|
export declare class SessionLogoutFlow extends SessionLogoutFlowBase {
|
|
15
|
+
/**
|
|
16
|
+
* Performs a full-page redirect to IDP OIDC `end_session_endpoint` via generated hidden `<form method="POST">`. Performing a `POST`
|
|
17
|
+
* request (instead of `GET` which supported by most IDPs) avoids leaking the `id_token` within the URL query params.
|
|
18
|
+
*
|
|
19
|
+
* @param logoutUrl - URL generated by {@link SessionLogoutFlow.start}
|
|
20
|
+
* @param options.parentElement - Parent element to append the generated `<form>` element to. Defaults to `document.body`
|
|
21
|
+
* @returns A {@link Promise} which never fulfills; therefore is blocking until the full-page redirect occurs.
|
|
22
|
+
*
|
|
23
|
+
* @see
|
|
24
|
+
* * {@link https://developer.okta.com/docs/api/openapi/okta-oauth/oauth/orgas/logoutwithpost | Okta Docs}
|
|
25
|
+
*/
|
|
3
26
|
static PerformPostRedirect(logoutUrl: URL, options?: Partial<SessionLogoutFlow.PostRedirectOptions>): Promise<unknown>;
|
|
4
27
|
}
|
|
28
|
+
/** {@inheritDoc SessionLogoutFlow} */
|
|
5
29
|
export declare namespace SessionLogoutFlow {
|
|
6
30
|
type PostRedirectOptions = {
|
|
7
31
|
parentElement: HTMLElement;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
1
5
|
import type { JsonRecord } from '@okta/auth-foundation/core';
|
|
2
6
|
import type { TransactionStorage } from '@okta/oauth2-flows';
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
3
10
|
export declare class BrowserTransactionStorage implements TransactionStorage {
|
|
4
11
|
#private;
|
|
5
12
|
private static version;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Includes extensions of OAuth2 flows designed for a browser environment. Performing oauth2 flows sometimes referred
|
|
3
|
+
* to as "front-channel"; The web application itself is requesting tokens from the authorization server.
|
|
4
|
+
*
|
|
5
|
+
* > [!IMPORTANT]
|
|
6
|
+
* > These exports are **NOT** available from the default export.
|
|
7
|
+
* >
|
|
8
|
+
* > Use `import from '@okta/spa-platform/flows'`.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Theses exports depend on `@okta/oauth2-flows`. In order to mark `@okta/oauth2-flows` as an optional dependency,
|
|
12
|
+
* these exports are kept separate from the default export.
|
|
13
|
+
*
|
|
14
|
+
* @see [SPA Platform: Entry Points](/api/spa-platform/#entry-points)
|
|
15
|
+
*
|
|
16
|
+
* @module Flows
|
|
4
17
|
*/
|
|
5
18
|
export * from './AuthorizationCodeFlow.ts';
|
|
6
19
|
export * from './SessionLogoutFlow.ts';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,17 +2,4 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export * from './
|
|
6
|
-
export * from '@okta/auth-foundation/core';
|
|
7
|
-
export { Credential } from './Credential/Credential.ts';
|
|
8
|
-
export { CredentialCoordinatorImpl } from './Credential/CredentialCoordinator.ts';
|
|
9
|
-
export { BrowserTokenStorage } from './Credential/TokenStorage.ts';
|
|
10
|
-
export { DefaultCredentialDataSource } from './Credential/CredentialDataSource.ts';
|
|
11
|
-
export { FetchClient } from './FetchClient/index.ts';
|
|
12
|
-
export * from './orchestrators/index.ts';
|
|
13
|
-
export * from './flows/index.ts';
|
|
14
|
-
export { DefaultSigningAuthority } from './platform/dpop/authority.ts';
|
|
15
|
-
export { clearDPoPKeyPairs } from './platform/index.ts';
|
|
16
|
-
export { PersistentCache } from './platform/dpop/nonceCache.ts';
|
|
17
|
-
export { OAuth2Client } from './platform/OAuth2Client.ts';
|
|
18
|
-
export * from './utils/isModernBrowser.ts';
|
|
5
|
+
export * from './core.ts';
|
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module
|
|
3
|
-
* @mergeModuleWith
|
|
3
|
+
* @mergeModuleWith Orchestrators
|
|
4
4
|
*/
|
|
5
5
|
import { Token, TokenOrchestrator, EventEmitter } from '@okta/auth-foundation/core';
|
|
6
6
|
import { AuthorizationCodeFlow } from '../flows/index.ts';
|
|
7
7
|
import { Credential } from '../Credential/index.ts';
|
|
8
8
|
/**
|
|
9
9
|
* An implementation of {@link AuthFoundation!TokenOrchestrator | TokenOrchestrator} leveraging
|
|
10
|
-
* {@link
|
|
11
|
-
*
|
|
10
|
+
* {@link Flows.AuthorizationCodeFlow | AuthorizationCodeFlow}
|
|
11
|
+
*
|
|
12
|
+
* Out-of-the-box this orchestrator will handle performing [Authorzation Code flow](/docs/references/authorization_code_flow) as well
|
|
13
|
+
* as storing and refreshing tokens.
|
|
14
|
+
*
|
|
15
|
+
* > [!IMPORTANT]
|
|
16
|
+
* > `AuthorizationCodeFlowOrchestrator` is **NOT** available from the default export since it requires `@okta/oauth2-flows`.
|
|
17
|
+
* >
|
|
18
|
+
* > Use `import { AuthorizationCodeFlowOrchestrator } from '@okta/spa-platform/flows'`.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* `AuthorizationCodeFlowOrchestrator` defaults to {@link Flows!AuthorizationCodeFlow.PerformRedirect | PerformRedirect}. This requires the application
|
|
22
|
+
* handles the redirect via {@link AuthorizationCodeFlowOrchestrator.resumeFlow}.
|
|
23
|
+
*
|
|
24
|
+
* @typeParam E - Map of all events fired from {@link TokenOrchestrator.emitter}
|
|
25
|
+
*
|
|
26
|
+
* @see
|
|
27
|
+
* * [SPA Platform: Authorization Code Flow](/api/spa-platform/#authorization-code-flow)
|
|
28
|
+
* * {@link Flows.AuthorizationCodeFlow | AuthorizationCodeFlow}
|
|
12
29
|
*/
|
|
13
30
|
export declare class AuthorizationCodeFlowOrchestrator<E extends AuthorizationCodeFlowOrchestrator.Events = AuthorizationCodeFlowOrchestrator.Events> extends TokenOrchestrator<E> {
|
|
14
31
|
readonly flow: AuthorizationCodeFlow;
|
|
32
|
+
/**
|
|
33
|
+
* Possible events: {@link AuthorizationCodeFlowOrchestrator.Events}
|
|
34
|
+
*/
|
|
15
35
|
protected readonly emitter: EventEmitter<E>;
|
|
16
36
|
options: AuthorizationCodeFlowOrchestrator.Options;
|
|
17
|
-
constructor(flow: AuthorizationCodeFlow, init?: AuthorizationCodeFlowOrchestrator.
|
|
37
|
+
constructor(flow: AuthorizationCodeFlow, init?: Partial<AuthorizationCodeFlowOrchestrator.Options>);
|
|
18
38
|
/**
|
|
19
|
-
* Defines how to handle the authorization code redirect
|
|
39
|
+
* Defines how to handle the authorization code redirect via
|
|
40
|
+
* {@link AuthFoundation!AuthorizationCodeFlow.resume | AuthorizationCodeFlow.resume}
|
|
20
41
|
*
|
|
21
42
|
* throws if an OAuth2 error is returned
|
|
22
43
|
*/
|
|
@@ -27,25 +48,38 @@ export declare class AuthorizationCodeFlowOrchestrator<E extends AuthorizationCo
|
|
|
27
48
|
selectCredential(options: TokenOrchestrator.AuthorizeParams): Promise<Credential | null>;
|
|
28
49
|
/**
|
|
29
50
|
* Defines how to store a newly acquired token
|
|
51
|
+
* @internal
|
|
30
52
|
*/
|
|
31
53
|
protected storeCredential(token: Token, tags?: string[] | undefined): Promise<Credential>;
|
|
32
54
|
/**
|
|
33
55
|
* Defines how to request a token from Authorization Server
|
|
56
|
+
* @internal
|
|
34
57
|
*/
|
|
35
58
|
protected requestToken(params: TokenOrchestrator.AuthorizeParams): Promise<Token | null>;
|
|
36
59
|
/**
|
|
37
60
|
* Determines if a valid token already exists in storage, otherwise requests a new token
|
|
38
61
|
*/
|
|
39
62
|
getToken(params?: TokenOrchestrator.AuthorizeParams): Promise<Token | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Removes invalidated tokens from storage
|
|
65
|
+
*/
|
|
66
|
+
invalidateToken(id: string): Promise<void>;
|
|
40
67
|
}
|
|
68
|
+
/** {@inheritDoc AuthorizationCodeFlowOrchestrator} */
|
|
41
69
|
export declare namespace AuthorizationCodeFlowOrchestrator {
|
|
70
|
+
/**
|
|
71
|
+
* Options to define behavior of {@link AuthorizationCodeFlowOrchestrator}.
|
|
72
|
+
*/
|
|
42
73
|
type Options = {
|
|
43
74
|
avoidPrompting: boolean;
|
|
44
75
|
emitBeforeRedirect: boolean;
|
|
45
76
|
getOriginalUri: () => string;
|
|
46
77
|
tags?: string[];
|
|
47
78
|
};
|
|
48
|
-
|
|
79
|
+
/**
|
|
80
|
+
* A map of possible events emitted by {@link AuthorizationCodeFlowOrchestrator.emitter}
|
|
81
|
+
* @interface
|
|
82
|
+
*/
|
|
49
83
|
type Events = {
|
|
50
84
|
'login_prompt_required': {
|
|
51
85
|
done: () => void;
|