@auth0/auth0-spa-js 2.18.0 → 2.18.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/dist/auth0-spa-js.development.js +330 -296
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/auth0-spa-js.worker.development.js +71 -21
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +353 -316
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +439 -439
- package/dist/typings/Auth0Client.utils.d.ts +90 -90
- package/dist/typings/MyAccountApiClient.d.ts +92 -92
- package/dist/typings/TokenExchange.d.ts +77 -77
- package/dist/typings/api.d.ts +2 -2
- package/dist/typings/cache/cache-localstorage.d.ts +7 -7
- package/dist/typings/cache/cache-manager.d.ts +56 -56
- package/dist/typings/cache/cache-memory.d.ts +4 -4
- package/dist/typings/cache/index.d.ts +4 -4
- package/dist/typings/cache/key-manifest.d.ts +12 -12
- package/dist/typings/cache/shared.d.ts +68 -68
- package/dist/typings/constants.d.ts +58 -58
- package/dist/typings/dpop/dpop.d.ts +17 -17
- package/dist/typings/dpop/storage.d.ts +27 -27
- package/dist/typings/dpop/utils.d.ts +15 -15
- package/dist/typings/errors.d.ts +96 -96
- package/dist/typings/fetcher.d.ts +54 -54
- package/dist/typings/global.d.ts +819 -819
- package/dist/typings/http.d.ts +5 -5
- package/dist/typings/index.d.ts +24 -23
- package/dist/typings/jwt.d.ts +21 -21
- package/dist/typings/lock.d.ts +32 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
- package/dist/typings/mfa/constants.d.ts +23 -23
- package/dist/typings/mfa/errors.d.ts +117 -117
- package/dist/typings/mfa/index.d.ts +4 -4
- package/dist/typings/mfa/types.d.ts +181 -181
- package/dist/typings/mfa/utils.d.ts +23 -23
- package/dist/typings/promise-utils.d.ts +2 -2
- package/dist/typings/scope.d.ts +35 -35
- package/dist/typings/storage.d.ts +26 -26
- package/dist/typings/transaction-manager.d.ts +33 -33
- package/dist/typings/utils.d.ts +36 -36
- package/dist/typings/version.d.ts +2 -2
- package/dist/typings/worker/token.worker.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +15 -15
- package/dist/typings/worker/worker.utils.d.ts +7 -7
- package/package.json +6 -4
- package/src/Auth0Client.ts +10 -7
- package/src/index.ts +6 -3
- package/src/utils.ts +2 -1
- package/src/version.ts +1 -1
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { ICache } from './cache';
|
|
2
|
-
import { Auth0ClientOptions, AuthorizationParams, AuthorizeOptions, ClientAuthorizationParams, LogoutOptions } from './global';
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export declare const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
export declare const buildGetTokenSilentlyLockKey: (clientId: string, audience: string) => string;
|
|
15
|
-
/**
|
|
16
|
-
* @ignore
|
|
17
|
-
* Builds a global lock key for iframe-based authentication flows.
|
|
18
|
-
* This ensures only one iframe authorization request runs at a time per client,
|
|
19
|
-
* preventing "Invalid state" errors from concurrent iframe requests overwriting
|
|
20
|
-
* each other's state in the Auth0 session.
|
|
21
|
-
*/
|
|
22
|
-
export declare const buildIframeLockKey: (clientId: string) => string;
|
|
23
|
-
/**
|
|
24
|
-
* @ignore
|
|
25
|
-
*/
|
|
26
|
-
export declare const buildOrganizationHintCookieName: (clientId: string) => string;
|
|
27
|
-
/**
|
|
28
|
-
* @ignore
|
|
29
|
-
*/
|
|
30
|
-
export declare const OLD_IS_AUTHENTICATED_COOKIE_NAME = "auth0.is.authenticated";
|
|
31
|
-
/**
|
|
32
|
-
* @ignore
|
|
33
|
-
*/
|
|
34
|
-
export declare const buildIsAuthenticatedCookieName: (clientId: string) => string;
|
|
35
|
-
/**
|
|
36
|
-
* @ignore
|
|
37
|
-
*/
|
|
38
|
-
export declare const cacheFactory: (location: string) => () => ICache;
|
|
39
|
-
/**
|
|
40
|
-
* @ignore
|
|
41
|
-
*/
|
|
42
|
-
export declare const getAuthorizeParams: (clientOptions: Auth0ClientOptions & {
|
|
43
|
-
authorizationParams: ClientAuthorizationParams;
|
|
44
|
-
}, scope: Record<string, string>, authorizationParams: AuthorizationParams & {
|
|
45
|
-
scope?: string | undefined;
|
|
46
|
-
}, state: string, nonce: string, code_challenge: string, redirect_uri: string | undefined, response_mode: string | undefined, thumbprint: string | undefined) => AuthorizeOptions;
|
|
47
|
-
/**
|
|
48
|
-
* @ignore
|
|
49
|
-
*
|
|
50
|
-
* Function used to provide support for the deprecated onRedirect through openUrl.
|
|
51
|
-
*/
|
|
52
|
-
export declare const patchOpenUrlWithOnRedirect: <T extends Pick<LogoutOptions, "
|
|
53
|
-
/**
|
|
54
|
-
* @ignore
|
|
55
|
-
*
|
|
56
|
-
* Checks if all scopes are included inside other array of scopes
|
|
57
|
-
*/
|
|
58
|
-
export declare const allScopesAreIncluded: (scopeToInclude?: string, scopes?: string) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* @ignore
|
|
61
|
-
*
|
|
62
|
-
* Returns the scopes that are missing after a refresh
|
|
63
|
-
*/
|
|
64
|
-
export declare const getMissingScopes: (requestedScope?: string, respondedScope?: string) => string;
|
|
65
|
-
/**
|
|
66
|
-
* @ignore
|
|
67
|
-
*
|
|
68
|
-
* For backward compatibility we are going to check if we are going to downscope while doing a refresh request
|
|
69
|
-
* while MRRT is allowed. If the audience is the same for the refresh_token we are going to use and it has
|
|
70
|
-
* lower scopes than the ones originally in the token, we are going to return the scopes that were stored
|
|
71
|
-
* with the refresh_token in the tokenset.
|
|
72
|
-
* @param useMrrt Setting that the user can activate to use MRRT in their requests
|
|
73
|
-
* @param authorizationParams Contains the audience and scope that the user requested to obtain a token
|
|
74
|
-
* @param cachedAudience Audience stored with the refresh_token wich we are going to use in the request
|
|
75
|
-
* @param cachedScope Scope stored with the refresh_token wich we are going to use in the request
|
|
76
|
-
*/
|
|
77
|
-
export declare const getScopeToRequest: (useMrrt: boolean | undefined, authorizationParams: {
|
|
78
|
-
audience?: string;
|
|
79
|
-
scope: string;
|
|
80
|
-
}, cachedAudience?: string, cachedScope?: string) => string;
|
|
81
|
-
/**
|
|
82
|
-
* @ignore
|
|
83
|
-
*
|
|
84
|
-
* Checks if the refresh request has been done using MRRT
|
|
85
|
-
* @param cachedAudience Audience from the refresh token used to refresh
|
|
86
|
-
* @param cachedScope Scopes from the refresh token used to refresh
|
|
87
|
-
* @param requestAudience Audience sent to the server
|
|
88
|
-
* @param requestScope Scopes sent to the server
|
|
89
|
-
*/
|
|
90
|
-
export declare const isRefreshWithMrrt: (cachedAudience: string | undefined, cachedScope: string | undefined, requestAudience: string | undefined, requestScope: string) => boolean;
|
|
1
|
+
import { ICache } from './cache';
|
|
2
|
+
import { Auth0ClientOptions, AuthorizationParams, AuthorizeOptions, ClientAuthorizationParams, LogoutOptions } from './global';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export declare const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
7
|
+
/**
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export declare const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
11
|
+
/**
|
|
12
|
+
* @ignore
|
|
13
|
+
*/
|
|
14
|
+
export declare const buildGetTokenSilentlyLockKey: (clientId: string, audience: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* @ignore
|
|
17
|
+
* Builds a global lock key for iframe-based authentication flows.
|
|
18
|
+
* This ensures only one iframe authorization request runs at a time per client,
|
|
19
|
+
* preventing "Invalid state" errors from concurrent iframe requests overwriting
|
|
20
|
+
* each other's state in the Auth0 session.
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildIframeLockKey: (clientId: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
export declare const buildOrganizationHintCookieName: (clientId: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* @ignore
|
|
29
|
+
*/
|
|
30
|
+
export declare const OLD_IS_AUTHENTICATED_COOKIE_NAME = "auth0.is.authenticated";
|
|
31
|
+
/**
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
export declare const buildIsAuthenticatedCookieName: (clientId: string) => string;
|
|
35
|
+
/**
|
|
36
|
+
* @ignore
|
|
37
|
+
*/
|
|
38
|
+
export declare const cacheFactory: (location: string) => () => ICache;
|
|
39
|
+
/**
|
|
40
|
+
* @ignore
|
|
41
|
+
*/
|
|
42
|
+
export declare const getAuthorizeParams: (clientOptions: Auth0ClientOptions & {
|
|
43
|
+
authorizationParams: ClientAuthorizationParams;
|
|
44
|
+
}, scope: Record<string, string>, authorizationParams: AuthorizationParams & {
|
|
45
|
+
scope?: string | undefined;
|
|
46
|
+
}, state: string, nonce: string, code_challenge: string, redirect_uri: string | undefined, response_mode: string | undefined, thumbprint: string | undefined) => AuthorizeOptions;
|
|
47
|
+
/**
|
|
48
|
+
* @ignore
|
|
49
|
+
*
|
|
50
|
+
* Function used to provide support for the deprecated onRedirect through openUrl.
|
|
51
|
+
*/
|
|
52
|
+
export declare const patchOpenUrlWithOnRedirect: <T extends Pick<LogoutOptions, "onRedirect" | "openUrl">>(options: T) => T;
|
|
53
|
+
/**
|
|
54
|
+
* @ignore
|
|
55
|
+
*
|
|
56
|
+
* Checks if all scopes are included inside other array of scopes
|
|
57
|
+
*/
|
|
58
|
+
export declare const allScopesAreIncluded: (scopeToInclude?: string, scopes?: string) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @ignore
|
|
61
|
+
*
|
|
62
|
+
* Returns the scopes that are missing after a refresh
|
|
63
|
+
*/
|
|
64
|
+
export declare const getMissingScopes: (requestedScope?: string, respondedScope?: string) => string;
|
|
65
|
+
/**
|
|
66
|
+
* @ignore
|
|
67
|
+
*
|
|
68
|
+
* For backward compatibility we are going to check if we are going to downscope while doing a refresh request
|
|
69
|
+
* while MRRT is allowed. If the audience is the same for the refresh_token we are going to use and it has
|
|
70
|
+
* lower scopes than the ones originally in the token, we are going to return the scopes that were stored
|
|
71
|
+
* with the refresh_token in the tokenset.
|
|
72
|
+
* @param useMrrt Setting that the user can activate to use MRRT in their requests
|
|
73
|
+
* @param authorizationParams Contains the audience and scope that the user requested to obtain a token
|
|
74
|
+
* @param cachedAudience Audience stored with the refresh_token wich we are going to use in the request
|
|
75
|
+
* @param cachedScope Scope stored with the refresh_token wich we are going to use in the request
|
|
76
|
+
*/
|
|
77
|
+
export declare const getScopeToRequest: (useMrrt: boolean | undefined, authorizationParams: {
|
|
78
|
+
audience?: string;
|
|
79
|
+
scope: string;
|
|
80
|
+
}, cachedAudience?: string, cachedScope?: string) => string;
|
|
81
|
+
/**
|
|
82
|
+
* @ignore
|
|
83
|
+
*
|
|
84
|
+
* Checks if the refresh request has been done using MRRT
|
|
85
|
+
* @param cachedAudience Audience from the refresh token used to refresh
|
|
86
|
+
* @param cachedScope Scopes from the refresh token used to refresh
|
|
87
|
+
* @param requestAudience Audience sent to the server
|
|
88
|
+
* @param requestScope Scopes sent to the server
|
|
89
|
+
*/
|
|
90
|
+
export declare const isRefreshWithMrrt: (cachedAudience: string | undefined, cachedScope: string | undefined, requestAudience: string | undefined, requestScope: string) => boolean;
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { AuthorizationParams } from './global';
|
|
2
|
-
import { Fetcher } from './fetcher';
|
|
3
|
-
interface ConnectRequest {
|
|
4
|
-
/** The name of the connection to link the account with (e.g., 'google-oauth2', 'facebook'). */
|
|
5
|
-
connection: string;
|
|
6
|
-
/** Array of scopes to request from the Identity Provider during the connect account flow. */
|
|
7
|
-
scopes?: string[];
|
|
8
|
-
/** The URI to redirect to after the connection process completes. */
|
|
9
|
-
redirect_uri: string;
|
|
10
|
-
/** An opaque value used to maintain state between the request and callback. */
|
|
11
|
-
state?: string;
|
|
12
|
-
/** The PKCE code challenge derived from the code verifier. */
|
|
13
|
-
code_challenge?: string;
|
|
14
|
-
/** The method used to derive the code challenge. Required when code_challenge is provided. */
|
|
15
|
-
code_challenge_method?: 'S256';
|
|
16
|
-
authorization_params?: AuthorizationParams;
|
|
17
|
-
}
|
|
18
|
-
interface ConnectResponse {
|
|
19
|
-
/** The base URI to initiate the account connection flow. */
|
|
20
|
-
connect_uri: string;
|
|
21
|
-
/** The authentication session identifier. */
|
|
22
|
-
auth_session: string;
|
|
23
|
-
/** Parameters to be used with the connect URI. */
|
|
24
|
-
connect_params: {
|
|
25
|
-
/** The ticket identifier to be used with the connection URI. */
|
|
26
|
-
ticket: string;
|
|
27
|
-
};
|
|
28
|
-
/** The number of seconds until the ticket expires. */
|
|
29
|
-
expires_in: number;
|
|
30
|
-
}
|
|
31
|
-
interface CompleteRequest {
|
|
32
|
-
/** The authentication session identifier */
|
|
33
|
-
auth_session: string;
|
|
34
|
-
/** The authorization code returned from the connect flow */
|
|
35
|
-
connect_code: string;
|
|
36
|
-
/** The redirect URI used in the original request */
|
|
37
|
-
redirect_uri: string;
|
|
38
|
-
/** The PKCE code verifier */
|
|
39
|
-
code_verifier?: string;
|
|
40
|
-
}
|
|
41
|
-
export interface CompleteResponse {
|
|
42
|
-
/** The unique identifier of the connected account */
|
|
43
|
-
id: string;
|
|
44
|
-
/** The connection name */
|
|
45
|
-
connection: string;
|
|
46
|
-
/** The access type, always 'offline' */
|
|
47
|
-
access_type: 'offline';
|
|
48
|
-
/** Array of scopes granted */
|
|
49
|
-
scopes?: string[];
|
|
50
|
-
/** ISO date string of when the connected account was created */
|
|
51
|
-
created_at: string;
|
|
52
|
-
/** ISO date string of when the refresh token expires (optional) */
|
|
53
|
-
expires_at?: string;
|
|
54
|
-
}
|
|
55
|
-
export interface ErrorResponse {
|
|
56
|
-
type: string;
|
|
57
|
-
status: number;
|
|
58
|
-
title: string;
|
|
59
|
-
detail: string;
|
|
60
|
-
validation_errors?: {
|
|
61
|
-
detail: string;
|
|
62
|
-
field?: string;
|
|
63
|
-
pointer?: string;
|
|
64
|
-
source?: string;
|
|
65
|
-
}[];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Subset of the MyAccount API that handles the connect accounts flow.
|
|
69
|
-
*/
|
|
70
|
-
export declare class MyAccountApiClient {
|
|
71
|
-
private myAccountFetcher;
|
|
72
|
-
private apiBase;
|
|
73
|
-
constructor(myAccountFetcher: Fetcher<Response>, apiBase: string);
|
|
74
|
-
/**
|
|
75
|
-
* Get a ticket for the connect account flow.
|
|
76
|
-
*/
|
|
77
|
-
connectAccount(params: ConnectRequest): Promise<ConnectResponse>;
|
|
78
|
-
/**
|
|
79
|
-
* Verify the redirect from the connect account flow and complete the connecting of the account.
|
|
80
|
-
*/
|
|
81
|
-
completeAccount(params: CompleteRequest): Promise<CompleteResponse>;
|
|
82
|
-
private _handleResponse;
|
|
83
|
-
}
|
|
84
|
-
export declare class MyAccountApiError extends Error {
|
|
85
|
-
readonly type: string;
|
|
86
|
-
readonly status: number;
|
|
87
|
-
readonly title: string;
|
|
88
|
-
readonly detail: string;
|
|
89
|
-
readonly validation_errors?: ErrorResponse['validation_errors'];
|
|
90
|
-
constructor({ type, status, title, detail, validation_errors }: ErrorResponse);
|
|
91
|
-
}
|
|
92
|
-
export {};
|
|
1
|
+
import { AuthorizationParams } from './global';
|
|
2
|
+
import { Fetcher } from './fetcher';
|
|
3
|
+
interface ConnectRequest {
|
|
4
|
+
/** The name of the connection to link the account with (e.g., 'google-oauth2', 'facebook'). */
|
|
5
|
+
connection: string;
|
|
6
|
+
/** Array of scopes to request from the Identity Provider during the connect account flow. */
|
|
7
|
+
scopes?: string[];
|
|
8
|
+
/** The URI to redirect to after the connection process completes. */
|
|
9
|
+
redirect_uri: string;
|
|
10
|
+
/** An opaque value used to maintain state between the request and callback. */
|
|
11
|
+
state?: string;
|
|
12
|
+
/** The PKCE code challenge derived from the code verifier. */
|
|
13
|
+
code_challenge?: string;
|
|
14
|
+
/** The method used to derive the code challenge. Required when code_challenge is provided. */
|
|
15
|
+
code_challenge_method?: 'S256';
|
|
16
|
+
authorization_params?: AuthorizationParams;
|
|
17
|
+
}
|
|
18
|
+
interface ConnectResponse {
|
|
19
|
+
/** The base URI to initiate the account connection flow. */
|
|
20
|
+
connect_uri: string;
|
|
21
|
+
/** The authentication session identifier. */
|
|
22
|
+
auth_session: string;
|
|
23
|
+
/** Parameters to be used with the connect URI. */
|
|
24
|
+
connect_params: {
|
|
25
|
+
/** The ticket identifier to be used with the connection URI. */
|
|
26
|
+
ticket: string;
|
|
27
|
+
};
|
|
28
|
+
/** The number of seconds until the ticket expires. */
|
|
29
|
+
expires_in: number;
|
|
30
|
+
}
|
|
31
|
+
interface CompleteRequest {
|
|
32
|
+
/** The authentication session identifier */
|
|
33
|
+
auth_session: string;
|
|
34
|
+
/** The authorization code returned from the connect flow */
|
|
35
|
+
connect_code: string;
|
|
36
|
+
/** The redirect URI used in the original request */
|
|
37
|
+
redirect_uri: string;
|
|
38
|
+
/** The PKCE code verifier */
|
|
39
|
+
code_verifier?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CompleteResponse {
|
|
42
|
+
/** The unique identifier of the connected account */
|
|
43
|
+
id: string;
|
|
44
|
+
/** The connection name */
|
|
45
|
+
connection: string;
|
|
46
|
+
/** The access type, always 'offline' */
|
|
47
|
+
access_type: 'offline';
|
|
48
|
+
/** Array of scopes granted */
|
|
49
|
+
scopes?: string[];
|
|
50
|
+
/** ISO date string of when the connected account was created */
|
|
51
|
+
created_at: string;
|
|
52
|
+
/** ISO date string of when the refresh token expires (optional) */
|
|
53
|
+
expires_at?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ErrorResponse {
|
|
56
|
+
type: string;
|
|
57
|
+
status: number;
|
|
58
|
+
title: string;
|
|
59
|
+
detail: string;
|
|
60
|
+
validation_errors?: {
|
|
61
|
+
detail: string;
|
|
62
|
+
field?: string;
|
|
63
|
+
pointer?: string;
|
|
64
|
+
source?: string;
|
|
65
|
+
}[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Subset of the MyAccount API that handles the connect accounts flow.
|
|
69
|
+
*/
|
|
70
|
+
export declare class MyAccountApiClient {
|
|
71
|
+
private myAccountFetcher;
|
|
72
|
+
private apiBase;
|
|
73
|
+
constructor(myAccountFetcher: Fetcher<Response>, apiBase: string);
|
|
74
|
+
/**
|
|
75
|
+
* Get a ticket for the connect account flow.
|
|
76
|
+
*/
|
|
77
|
+
connectAccount(params: ConnectRequest): Promise<ConnectResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Verify the redirect from the connect account flow and complete the connecting of the account.
|
|
80
|
+
*/
|
|
81
|
+
completeAccount(params: CompleteRequest): Promise<CompleteResponse>;
|
|
82
|
+
private _handleResponse;
|
|
83
|
+
}
|
|
84
|
+
export declare class MyAccountApiError extends Error {
|
|
85
|
+
readonly type: string;
|
|
86
|
+
readonly status: number;
|
|
87
|
+
readonly title: string;
|
|
88
|
+
readonly detail: string;
|
|
89
|
+
readonly validation_errors?: ErrorResponse['validation_errors'];
|
|
90
|
+
constructor({ type, status, title, detail, validation_errors }: ErrorResponse);
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the configuration options required for initiating a Custom Token Exchange request
|
|
3
|
-
* following RFC 8693 specifications.
|
|
4
|
-
*
|
|
5
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc8693 | RFC 8693: OAuth 2.0 Token Exchange}
|
|
6
|
-
*/
|
|
7
|
-
export type CustomTokenExchangeOptions = {
|
|
8
|
-
/**
|
|
9
|
-
* The type identifier for the subject token being exchanged
|
|
10
|
-
*
|
|
11
|
-
* @pattern
|
|
12
|
-
* - Must be a namespaced URI under your organization's control
|
|
13
|
-
* - Forbidden patterns:
|
|
14
|
-
* - `^urn:ietf:params:oauth:*` (IETF reserved)
|
|
15
|
-
* - `^https:\/\/auth0\.com/*` (Auth0 reserved)
|
|
16
|
-
* - `^urn:auth0:*` (Auth0 reserved)
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* "urn:acme:legacy-system-token"
|
|
20
|
-
* "https://api.yourcompany.com/token-type/v1"
|
|
21
|
-
*/
|
|
22
|
-
subject_token_type: string;
|
|
23
|
-
/**
|
|
24
|
-
* The opaque token value being exchanged for Auth0 tokens
|
|
25
|
-
*
|
|
26
|
-
* @security
|
|
27
|
-
* - Must be validated in Auth0 Actions using strong cryptographic verification
|
|
28
|
-
* - Implement replay attack protection
|
|
29
|
-
* - Recommended validation libraries: `jose`, `jsonwebtoken`
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
33
|
-
*/
|
|
34
|
-
subject_token: string;
|
|
35
|
-
/**
|
|
36
|
-
* The target audience for the requested Auth0 token
|
|
37
|
-
*
|
|
38
|
-
* @remarks
|
|
39
|
-
* Must match exactly with an API identifier configured in your Auth0 tenant.
|
|
40
|
-
* If not provided, falls back to the client's default audience.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* "https://api.your-service.com/v1"
|
|
44
|
-
*/
|
|
45
|
-
audience?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Space-separated list of OAuth 2.0 scopes being requested
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* Subject to API authorization policies configured in Auth0
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* "openid profile email read:data write:data"
|
|
54
|
-
*/
|
|
55
|
-
scope?: string;
|
|
56
|
-
/**
|
|
57
|
-
* ID or name of the organization to use when authenticating a user.
|
|
58
|
-
* When provided, the user will be authenticated using the organization context.
|
|
59
|
-
* The organization ID will be present in the access token payload.
|
|
60
|
-
*/
|
|
61
|
-
organization?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Additional custom parameters for Auth0 Action processing
|
|
64
|
-
*
|
|
65
|
-
* @remarks
|
|
66
|
-
* Accessible in Action code via `event.request.body`
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* {
|
|
71
|
-
* custom_parameter: "session_context",
|
|
72
|
-
* device_fingerprint: "a3d8f7...",
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
[key: string]: unknown;
|
|
77
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Represents the configuration options required for initiating a Custom Token Exchange request
|
|
3
|
+
* following RFC 8693 specifications.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8693 | RFC 8693: OAuth 2.0 Token Exchange}
|
|
6
|
+
*/
|
|
7
|
+
export type CustomTokenExchangeOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* The type identifier for the subject token being exchanged
|
|
10
|
+
*
|
|
11
|
+
* @pattern
|
|
12
|
+
* - Must be a namespaced URI under your organization's control
|
|
13
|
+
* - Forbidden patterns:
|
|
14
|
+
* - `^urn:ietf:params:oauth:*` (IETF reserved)
|
|
15
|
+
* - `^https:\/\/auth0\.com/*` (Auth0 reserved)
|
|
16
|
+
* - `^urn:auth0:*` (Auth0 reserved)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* "urn:acme:legacy-system-token"
|
|
20
|
+
* "https://api.yourcompany.com/token-type/v1"
|
|
21
|
+
*/
|
|
22
|
+
subject_token_type: string;
|
|
23
|
+
/**
|
|
24
|
+
* The opaque token value being exchanged for Auth0 tokens
|
|
25
|
+
*
|
|
26
|
+
* @security
|
|
27
|
+
* - Must be validated in Auth0 Actions using strong cryptographic verification
|
|
28
|
+
* - Implement replay attack protection
|
|
29
|
+
* - Recommended validation libraries: `jose`, `jsonwebtoken`
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
33
|
+
*/
|
|
34
|
+
subject_token: string;
|
|
35
|
+
/**
|
|
36
|
+
* The target audience for the requested Auth0 token
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Must match exactly with an API identifier configured in your Auth0 tenant.
|
|
40
|
+
* If not provided, falls back to the client's default audience.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* "https://api.your-service.com/v1"
|
|
44
|
+
*/
|
|
45
|
+
audience?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Space-separated list of OAuth 2.0 scopes being requested
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Subject to API authorization policies configured in Auth0
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* "openid profile email read:data write:data"
|
|
54
|
+
*/
|
|
55
|
+
scope?: string;
|
|
56
|
+
/**
|
|
57
|
+
* ID or name of the organization to use when authenticating a user.
|
|
58
|
+
* When provided, the user will be authenticated using the organization context.
|
|
59
|
+
* The organization ID will be present in the access token payload.
|
|
60
|
+
*/
|
|
61
|
+
organization?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Additional custom parameters for Auth0 Action processing
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Accessible in Action code via `event.request.body`
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* {
|
|
71
|
+
* custom_parameter: "session_context",
|
|
72
|
+
* device_fingerprint: "a3d8f7...",
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
};
|
package/dist/typings/api.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TokenEndpointOptions, TokenEndpointResponse } from './global';
|
|
2
|
-
export declare function oauthToken({ baseUrl, timeout, audience, scope, auth0Client, useFormData, useMrrt, dpop, ...options }: TokenEndpointOptions, worker?: Worker): Promise<TokenEndpointResponse>;
|
|
1
|
+
import { TokenEndpointOptions, TokenEndpointResponse } from './global';
|
|
2
|
+
export declare function oauthToken({ baseUrl, timeout, audience, scope, auth0Client, useFormData, useMrrt, dpop, ...options }: TokenEndpointOptions, worker?: Worker): Promise<TokenEndpointResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ICache, Cacheable, MaybePromise } from './shared';
|
|
2
|
-
export declare class LocalStorageCache implements ICache {
|
|
3
|
-
set<T = Cacheable>(key: string, entry: T): void;
|
|
4
|
-
get<T = Cacheable>(key: string): MaybePromise<T | undefined>;
|
|
5
|
-
remove(key: string): void;
|
|
6
|
-
allKeys(): string[];
|
|
7
|
-
}
|
|
1
|
+
import { ICache, Cacheable, MaybePromise } from './shared';
|
|
2
|
+
export declare class LocalStorageCache implements ICache {
|
|
3
|
+
set<T = Cacheable>(key: string, entry: T): void;
|
|
4
|
+
get<T = Cacheable>(key: string): MaybePromise<T | undefined>;
|
|
5
|
+
remove(key: string): void;
|
|
6
|
+
allKeys(): string[];
|
|
7
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { CacheKeyManifest } from './key-manifest';
|
|
2
|
-
import { CacheEntry, ICache, CacheKey, DecodedToken, IdTokenEntry } from './shared';
|
|
3
|
-
export declare class CacheManager {
|
|
4
|
-
private cache;
|
|
5
|
-
private keyManifest?;
|
|
6
|
-
private nowProvider;
|
|
7
|
-
constructor(cache: ICache, keyManifest?: CacheKeyManifest | undefined, nowProvider?: () => number | Promise<number>);
|
|
8
|
-
setIdToken(clientId: string, idToken: string, decodedToken: DecodedToken): Promise<void>;
|
|
9
|
-
getIdToken(cacheKey: CacheKey): Promise<IdTokenEntry | undefined>;
|
|
10
|
-
get(cacheKey: CacheKey, expiryAdjustmentSeconds?: number, useMrrt?: boolean, cacheMode?: string): Promise<Partial<CacheEntry> | undefined>;
|
|
11
|
-
private modifiedCachedEntry;
|
|
12
|
-
set(entry: CacheEntry): Promise<void>;
|
|
13
|
-
remove(client_id: string, audience?: string, scope?: string): Promise<void>;
|
|
14
|
-
clear(clientId?: string): Promise<void>;
|
|
15
|
-
private wrapCacheEntry;
|
|
16
|
-
private getCacheKeys;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the cache key to be used to store the id token
|
|
19
|
-
* @param clientId The client id used to link to the id token
|
|
20
|
-
* @returns The constructed cache key, as a string, to store the id token
|
|
21
|
-
*/
|
|
22
|
-
private getIdTokenCacheKey;
|
|
23
|
-
/**
|
|
24
|
-
* Finds the corresponding key in the cache based on the provided cache key.
|
|
25
|
-
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
26
|
-
* The first key in the cache that satisfies the following conditions is returned
|
|
27
|
-
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
28
|
-
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
29
|
-
* - `audience` is strict equal to the `cacheKey.audience`
|
|
30
|
-
* - `scope` contains at least all the `cacheKey.scope` values
|
|
31
|
-
* *
|
|
32
|
-
* @param keyToMatch The provided cache key
|
|
33
|
-
* @param allKeys A list of existing cache keys
|
|
34
|
-
*/
|
|
35
|
-
private matchExistingCacheKey;
|
|
36
|
-
/**
|
|
37
|
-
* Returns the first entry that contains a refresh_token that satisfies the following conditions
|
|
38
|
-
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
39
|
-
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
40
|
-
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
41
|
-
* @param keyToMatch The provided cache key
|
|
42
|
-
* @param allKeys A list of existing cache keys
|
|
43
|
-
*/
|
|
44
|
-
private getEntryWithRefreshToken;
|
|
45
|
-
/**
|
|
46
|
-
* Updates the refresh token in all cache entries that contain the old refresh token.
|
|
47
|
-
*
|
|
48
|
-
* When a refresh token is rotated, multiple cache entries (for different audiences/scopes)
|
|
49
|
-
* may share the same refresh token. This method propagates the new refresh token to all
|
|
50
|
-
* matching entries.
|
|
51
|
-
*
|
|
52
|
-
* @param oldRefreshToken The refresh token that was used and is now invalid
|
|
53
|
-
* @param newRefreshToken The new refresh token received from the server
|
|
54
|
-
*/
|
|
55
|
-
updateEntry(oldRefreshToken: string, newRefreshToken: string): Promise<void>;
|
|
56
|
-
}
|
|
1
|
+
import { CacheKeyManifest } from './key-manifest';
|
|
2
|
+
import { CacheEntry, ICache, CacheKey, DecodedToken, IdTokenEntry } from './shared';
|
|
3
|
+
export declare class CacheManager {
|
|
4
|
+
private cache;
|
|
5
|
+
private keyManifest?;
|
|
6
|
+
private nowProvider;
|
|
7
|
+
constructor(cache: ICache, keyManifest?: CacheKeyManifest | undefined, nowProvider?: () => number | Promise<number>);
|
|
8
|
+
setIdToken(clientId: string, idToken: string, decodedToken: DecodedToken): Promise<void>;
|
|
9
|
+
getIdToken(cacheKey: CacheKey): Promise<IdTokenEntry | undefined>;
|
|
10
|
+
get(cacheKey: CacheKey, expiryAdjustmentSeconds?: number, useMrrt?: boolean, cacheMode?: string): Promise<Partial<CacheEntry> | undefined>;
|
|
11
|
+
private modifiedCachedEntry;
|
|
12
|
+
set(entry: CacheEntry): Promise<void>;
|
|
13
|
+
remove(client_id: string, audience?: string, scope?: string): Promise<void>;
|
|
14
|
+
clear(clientId?: string): Promise<void>;
|
|
15
|
+
private wrapCacheEntry;
|
|
16
|
+
private getCacheKeys;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the cache key to be used to store the id token
|
|
19
|
+
* @param clientId The client id used to link to the id token
|
|
20
|
+
* @returns The constructed cache key, as a string, to store the id token
|
|
21
|
+
*/
|
|
22
|
+
private getIdTokenCacheKey;
|
|
23
|
+
/**
|
|
24
|
+
* Finds the corresponding key in the cache based on the provided cache key.
|
|
25
|
+
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
26
|
+
* The first key in the cache that satisfies the following conditions is returned
|
|
27
|
+
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
28
|
+
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
29
|
+
* - `audience` is strict equal to the `cacheKey.audience`
|
|
30
|
+
* - `scope` contains at least all the `cacheKey.scope` values
|
|
31
|
+
* *
|
|
32
|
+
* @param keyToMatch The provided cache key
|
|
33
|
+
* @param allKeys A list of existing cache keys
|
|
34
|
+
*/
|
|
35
|
+
private matchExistingCacheKey;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the first entry that contains a refresh_token that satisfies the following conditions
|
|
38
|
+
* The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
|
|
39
|
+
* - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
|
|
40
|
+
* - `clientId` is strict equal to the `cacheKey.clientId`
|
|
41
|
+
* @param keyToMatch The provided cache key
|
|
42
|
+
* @param allKeys A list of existing cache keys
|
|
43
|
+
*/
|
|
44
|
+
private getEntryWithRefreshToken;
|
|
45
|
+
/**
|
|
46
|
+
* Updates the refresh token in all cache entries that contain the old refresh token.
|
|
47
|
+
*
|
|
48
|
+
* When a refresh token is rotated, multiple cache entries (for different audiences/scopes)
|
|
49
|
+
* may share the same refresh token. This method propagates the new refresh token to all
|
|
50
|
+
* matching entries.
|
|
51
|
+
*
|
|
52
|
+
* @param oldRefreshToken The refresh token that was used and is now invalid
|
|
53
|
+
* @param newRefreshToken The new refresh token received from the server
|
|
54
|
+
*/
|
|
55
|
+
updateEntry(oldRefreshToken: string, newRefreshToken: string): Promise<void>;
|
|
56
|
+
}
|