@globus/sdk 2.4.1 → 3.0.0-alpha.10
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/cjs/index.d.ts +2 -1
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +3 -2
- package/cjs/index.js.map +1 -1
- package/cjs/lib/core/authorization/AuthorizationManager.d.ts +95 -0
- package/cjs/lib/core/authorization/AuthorizationManager.d.ts.map +1 -0
- package/cjs/lib/core/authorization/AuthorizationManager.js +202 -0
- package/cjs/lib/core/authorization/AuthorizationManager.js.map +1 -0
- package/cjs/lib/core/authorization/Event.d.ts +12 -0
- package/cjs/lib/core/authorization/Event.d.ts.map +1 -0
- package/cjs/lib/core/authorization/Event.js +29 -0
- package/cjs/lib/core/authorization/Event.js.map +1 -0
- package/cjs/lib/core/authorization/RedirectTransport.d.ts +14 -0
- package/cjs/lib/core/authorization/RedirectTransport.d.ts.map +1 -0
- package/cjs/lib/core/authorization/RedirectTransport.js +41 -0
- package/cjs/lib/core/authorization/RedirectTransport.js.map +1 -0
- package/cjs/lib/core/authorization/TokenLookup.d.ts +12 -0
- package/cjs/lib/core/authorization/TokenLookup.d.ts.map +1 -0
- package/cjs/lib/core/authorization/TokenLookup.js +31 -0
- package/cjs/lib/core/authorization/TokenLookup.js.map +1 -0
- package/cjs/lib/core/authorization/index.d.ts +13 -0
- package/cjs/lib/core/authorization/index.d.ts.map +1 -0
- package/cjs/lib/core/authorization/index.js +20 -0
- package/cjs/lib/core/authorization/index.js.map +1 -0
- package/cjs/lib/core/authorization/tokens.d.ts +7 -0
- package/cjs/lib/core/authorization/tokens.d.ts.map +1 -0
- package/cjs/lib/core/authorization/tokens.js +23 -0
- package/cjs/lib/core/authorization/tokens.js.map +1 -0
- package/cjs/lib/core/errors.d.ts +21 -0
- package/cjs/lib/core/errors.d.ts.map +1 -1
- package/cjs/lib/core/errors.js +19 -1
- package/cjs/lib/core/errors.js.map +1 -1
- package/cjs/lib/core/global.d.ts +2 -0
- package/cjs/lib/core/global.d.ts.map +1 -1
- package/cjs/lib/core/global.js +3 -2
- package/cjs/lib/core/global.js.map +1 -1
- package/cjs/lib/core/logger.d.ts +31 -0
- package/cjs/lib/core/logger.d.ts.map +1 -0
- package/cjs/lib/core/logger.js +54 -0
- package/cjs/lib/core/logger.js.map +1 -0
- package/cjs/lib/core/storage/index.d.ts +1 -1
- package/cjs/lib/core/storage/index.d.ts.map +1 -1
- package/cjs/lib/core/storage/index.js +0 -4
- package/cjs/lib/core/storage/index.js.map +1 -1
- package/cjs/lib/core/storage/local-storage.d.ts +2 -1
- package/cjs/lib/core/storage/local-storage.d.ts.map +1 -1
- package/cjs/lib/core/storage/local-storage.js +10 -5
- package/cjs/lib/core/storage/local-storage.js.map +1 -1
- package/cjs/lib/core/storage/memory.d.ts +2 -2
- package/cjs/lib/core/storage/memory.d.ts.map +1 -1
- package/cjs/lib/core/storage/memory.js +7 -7
- package/cjs/lib/core/storage/memory.js.map +1 -1
- package/cjs/lib/services/auth/config.d.ts +5 -0
- package/cjs/lib/services/auth/config.d.ts.map +1 -1
- package/cjs/lib/services/auth/config.js +8 -1
- package/cjs/lib/services/auth/config.js.map +1 -1
- package/cjs/lib/services/auth/index.d.ts +8 -9
- package/cjs/lib/services/auth/index.d.ts.map +1 -1
- package/cjs/lib/services/auth/index.js +14 -1
- package/cjs/lib/services/auth/index.js.map +1 -1
- package/cjs/lib/services/globus-connect-server/client.d.ts +58 -58
- package/cjs/lib/services/shared.js +2 -2
- package/cjs/lib/services/shared.js.map +1 -1
- package/cjs/lib/services/transfer/service/file-operations.d.ts +49 -1
- package/cjs/lib/services/transfer/service/file-operations.d.ts.map +1 -1
- package/cjs/lib/services/transfer/service/file-operations.js.map +1 -1
- package/cjs/lib/services/transfer/service/task-submission.d.ts +64 -4
- package/cjs/lib/services/transfer/service/task-submission.d.ts.map +1 -1
- package/cjs/lib/services/transfer/service/task-submission.js +3 -0
- package/cjs/lib/services/transfer/service/task-submission.js.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/lib/core/authorization/AuthorizationManager.d.ts +95 -0
- package/esm/lib/core/authorization/AuthorizationManager.d.ts.map +1 -0
- package/esm/lib/core/authorization/AuthorizationManager.js +198 -0
- package/esm/lib/core/authorization/AuthorizationManager.js.map +1 -0
- package/esm/lib/core/authorization/Event.d.ts +12 -0
- package/esm/lib/core/authorization/Event.d.ts.map +1 -0
- package/esm/lib/core/authorization/Event.js +25 -0
- package/esm/lib/core/authorization/Event.js.map +1 -0
- package/esm/lib/core/authorization/RedirectTransport.d.ts +14 -0
- package/esm/lib/core/authorization/RedirectTransport.d.ts.map +1 -0
- package/esm/lib/core/authorization/RedirectTransport.js +37 -0
- package/esm/lib/core/authorization/RedirectTransport.js.map +1 -0
- package/esm/lib/core/authorization/TokenLookup.d.ts +12 -0
- package/esm/lib/core/authorization/TokenLookup.d.ts.map +1 -0
- package/esm/lib/core/authorization/TokenLookup.js +27 -0
- package/esm/lib/core/authorization/TokenLookup.js.map +1 -0
- package/esm/lib/core/authorization/index.d.ts +13 -0
- package/esm/lib/core/authorization/index.d.ts.map +1 -0
- package/esm/lib/core/authorization/index.js +15 -0
- package/esm/lib/core/authorization/index.js.map +1 -0
- package/esm/lib/core/authorization/tokens.d.ts +7 -0
- package/esm/lib/core/authorization/tokens.d.ts.map +1 -0
- package/esm/lib/core/authorization/tokens.js +19 -0
- package/esm/lib/core/authorization/tokens.js.map +1 -0
- package/esm/lib/core/errors.d.ts +21 -0
- package/esm/lib/core/errors.d.ts.map +1 -1
- package/esm/lib/core/errors.js +15 -0
- package/esm/lib/core/errors.js.map +1 -1
- package/esm/lib/core/global.d.ts +2 -0
- package/esm/lib/core/global.d.ts.map +1 -1
- package/esm/lib/core/global.js +1 -1
- package/esm/lib/core/global.js.map +1 -1
- package/esm/lib/core/logger.d.ts +31 -0
- package/esm/lib/core/logger.d.ts.map +1 -0
- package/esm/lib/core/logger.js +48 -0
- package/esm/lib/core/logger.js.map +1 -0
- package/esm/lib/core/storage/index.d.ts +1 -1
- package/esm/lib/core/storage/index.d.ts.map +1 -1
- package/esm/lib/core/storage/index.js +0 -4
- package/esm/lib/core/storage/index.js.map +1 -1
- package/esm/lib/core/storage/local-storage.d.ts +2 -1
- package/esm/lib/core/storage/local-storage.d.ts.map +1 -1
- package/esm/lib/core/storage/local-storage.js +10 -5
- package/esm/lib/core/storage/local-storage.js.map +1 -1
- package/esm/lib/core/storage/memory.d.ts +2 -2
- package/esm/lib/core/storage/memory.d.ts.map +1 -1
- package/esm/lib/core/storage/memory.js +7 -7
- package/esm/lib/core/storage/memory.js.map +1 -1
- package/esm/lib/services/auth/config.d.ts +5 -0
- package/esm/lib/services/auth/config.d.ts.map +1 -1
- package/esm/lib/services/auth/config.js +7 -0
- package/esm/lib/services/auth/config.js.map +1 -1
- package/esm/lib/services/auth/index.d.ts +8 -9
- package/esm/lib/services/auth/index.d.ts.map +1 -1
- package/esm/lib/services/auth/index.js +12 -0
- package/esm/lib/services/auth/index.js.map +1 -1
- package/esm/lib/services/globus-connect-server/client.d.ts +58 -58
- package/esm/lib/services/shared.js +1 -1
- package/esm/lib/services/shared.js.map +1 -1
- package/esm/lib/services/transfer/service/file-operations.d.ts +49 -1
- package/esm/lib/services/transfer/service/file-operations.d.ts.map +1 -1
- package/esm/lib/services/transfer/service/file-operations.js.map +1 -1
- package/esm/lib/services/transfer/service/task-submission.d.ts +64 -4
- package/esm/lib/services/transfer/service/task-submission.d.ts.map +1 -1
- package/esm/lib/services/transfer/service/task-submission.js +3 -0
- package/esm/lib/services/transfer/service/task-submission.js.map +1 -1
- package/package.json +1 -1
- package/umd/globus.production.js +1 -1
- package/cjs/lib/core/authorization.d.ts +0 -30
- package/cjs/lib/core/authorization.d.ts.map +0 -1
- package/cjs/lib/core/authorization.js +0 -94
- package/cjs/lib/core/authorization.js.map +0 -1
- package/cjs/lib/core/consent.d.ts +0 -11
- package/cjs/lib/core/consent.d.ts.map +0 -1
- package/cjs/lib/core/consent.js +0 -41
- package/cjs/lib/core/consent.js.map +0 -1
- package/esm/lib/core/authorization.d.ts +0 -30
- package/esm/lib/core/authorization.d.ts.map +0 -1
- package/esm/lib/core/authorization.js +0 -88
- package/esm/lib/core/authorization.js.map +0 -1
- package/esm/lib/core/consent.d.ts +0 -11
- package/esm/lib/core/consent.d.ts.map +0 -1
- package/esm/lib/core/consent.js +0 -35
- package/esm/lib/core/consent.js.map +0 -1
package/cjs/index.d.ts
CHANGED
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
*
|
|
52
52
|
* const result = await (await flows.flows.get("452bbea3-5e3b-45a5-af08-50179839a4e8")).json();
|
|
53
53
|
*/
|
|
54
|
-
export * as
|
|
54
|
+
export * as logger from './lib/core/logger.js';
|
|
55
|
+
export * as authorization from './lib/core/authorization/index.js';
|
|
55
56
|
export * as auth from './lib/services/auth/index.js';
|
|
56
57
|
export * as transfer from './lib/services/transfer/index.js';
|
|
57
58
|
export * as search from './lib/services/search/index.js';
|
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAOH,OAAO,KAAK,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAOH,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,+BAA+B,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,+CAA+C,CAAC;AACrE,OAAO,KAAK,KAAK,MAAM,+BAA+B,CAAC"}
|
package/cjs/index.js
CHANGED
|
@@ -53,13 +53,14 @@
|
|
|
53
53
|
* const result = await (await flows.flows.get("452bbea3-5e3b-45a5-af08-50179839a4e8")).json();
|
|
54
54
|
*/
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.timer = exports.gcs = exports.flows = exports.groups = exports.search = exports.transfer = exports.auth = exports.authorization = void 0;
|
|
56
|
+
exports.timer = exports.gcs = exports.flows = exports.groups = exports.search = exports.transfer = exports.auth = exports.authorization = exports.logger = void 0;
|
|
57
57
|
const tslib_1 = require("tslib");
|
|
58
58
|
/// <reference types="@globus/types" />
|
|
59
59
|
/// <reference types="@globus/types/auth" />
|
|
60
60
|
/// <reference types="@globus/types/transfer" />
|
|
61
61
|
/// <reference types="@globus/types/search" />
|
|
62
|
-
exports.
|
|
62
|
+
exports.logger = tslib_1.__importStar(require("./lib/core/logger.js"));
|
|
63
|
+
exports.authorization = tslib_1.__importStar(require("./lib/core/authorization/index.js"));
|
|
63
64
|
exports.auth = tslib_1.__importStar(require("./lib/services/auth/index.js"));
|
|
64
65
|
exports.transfer = tslib_1.__importStar(require("./lib/services/transfer/index.js"));
|
|
65
66
|
exports.search = tslib_1.__importStar(require("./lib/services/search/index.js"));
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;;;;AAEH,uCAAuC;AACvC,4CAA4C;AAC5C,gDAAgD;AAChD,8CAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;;;;AAEH,uCAAuC;AACvC,4CAA4C;AAC5C,gDAAgD;AAChD,8CAA8C;AAE9C,uEAA+C;AAE/C,2FAAmE;AACnE,6EAAqD;AACrD,qFAA6D;AAC7D,iFAAyD;AACzD,iFAAyD;AACzD,+EAAuD;AACvD,6FAAqE;AACrE,+EAAuD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type IConfig from 'js-pkce/dist/IConfig';
|
|
2
|
+
import { Token, TokenResponse } from '../../services/auth/index.js';
|
|
3
|
+
import { Event } from './Event.js';
|
|
4
|
+
import { TokenLookup } from './TokenLookup.js';
|
|
5
|
+
import { AuthorizationRequirementsError, ConsentRequiredError } from '../errors.js';
|
|
6
|
+
export type AuthorizationManagerConfiguration = {
|
|
7
|
+
client_id: IConfig['client_id'];
|
|
8
|
+
requested_scopes: IConfig['requested_scopes'];
|
|
9
|
+
redirect_uri: IConfig['redirect_uri'];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @experimental
|
|
13
|
+
*/
|
|
14
|
+
export declare class AuthorizationManager {
|
|
15
|
+
#private;
|
|
16
|
+
configuration: AuthorizationManagerConfiguration;
|
|
17
|
+
/**
|
|
18
|
+
* The `AuthorizationManager` is consdiered `authenticated` if it has a valid Globus Auth token.
|
|
19
|
+
* It does not necessarily mean that it has a valid token for a specific resource server.
|
|
20
|
+
*/
|
|
21
|
+
get authenticated(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Set the authenticated state and emit the `authenticated` event.
|
|
24
|
+
*/
|
|
25
|
+
set authenticated(value: boolean);
|
|
26
|
+
tokens: TokenLookup;
|
|
27
|
+
events: {
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when the authenticated state changes.
|
|
30
|
+
* @event AuthorizationManager.events#authenticated
|
|
31
|
+
* @type {object}
|
|
32
|
+
* @property {boolean} isAuthenticated - Whether the `AuthorizationManager` is authenticated.
|
|
33
|
+
* @property {TokenResponse} [token] - The token response if the `AuthorizationManager` is authenticated.
|
|
34
|
+
*/
|
|
35
|
+
authenticated: Event<"authenticated", {
|
|
36
|
+
/**
|
|
37
|
+
* Whether the `AuthorizationManager` is authenticated.
|
|
38
|
+
* @see {@link AuthorizationManager.authenticated}
|
|
39
|
+
*/
|
|
40
|
+
isAuthenticated: boolean;
|
|
41
|
+
token?: TokenResponse | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Emitted when the user revokes their authentication.
|
|
45
|
+
* @event AuthorizationManager.events#revoke
|
|
46
|
+
*/
|
|
47
|
+
revoke: Event<"revoke", unknown>;
|
|
48
|
+
};
|
|
49
|
+
constructor(configuration: AuthorizationManagerConfiguration);
|
|
50
|
+
startSilentRenew(): void;
|
|
51
|
+
hasGlobusAuthToken(): boolean;
|
|
52
|
+
getGlobusAuthToken(): any;
|
|
53
|
+
/**
|
|
54
|
+
* Reset the authenticated state and clear all tokens from storage.
|
|
55
|
+
* This method **does not** emit the `revoke` event. If you need to emit the `revoke` event, use the `AuthorizationManager.revoke` method.
|
|
56
|
+
*/
|
|
57
|
+
reset(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
60
|
+
*/
|
|
61
|
+
login(): void;
|
|
62
|
+
handleCodeRedirect(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Handle an error response from a Globus service in the context of this `AuthorizationManager`.
|
|
65
|
+
* This method will introspect the response and attempt to handle any errors that should result
|
|
66
|
+
* in some additional Globus Auth interaction.
|
|
67
|
+
* @param response - The error response from a Globus service.
|
|
68
|
+
* @param execute - Whether to execute the handler immediately or return a function that can be executed later.
|
|
69
|
+
*/
|
|
70
|
+
handleErrorResponse(response: Record<string, unknown>, execute?: true): void;
|
|
71
|
+
handleErrorResponse(response: Record<string, unknown>, execute?: false): () => void;
|
|
72
|
+
/**
|
|
73
|
+
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
74
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
75
|
+
*/
|
|
76
|
+
handleAuthorizationRequirementsError(response: AuthorizationRequirementsError): void;
|
|
77
|
+
/**
|
|
78
|
+
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
79
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
80
|
+
*/
|
|
81
|
+
handleConsentRequiredError(response: ConsentRequiredError): void;
|
|
82
|
+
/**
|
|
83
|
+
* Add a Globus Auth token response to storage, if `other_tokens` are present they are also added.
|
|
84
|
+
* This method is mostly used internally by the `AuthorizationManager`, but can be used by downstream
|
|
85
|
+
* consumers to add tokens to storage if necessary.
|
|
86
|
+
*/
|
|
87
|
+
addTokenResponse: (token: Token | TokenResponse) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Call `AuthroizationManager.reset` and emit the `revoke` event.
|
|
90
|
+
* @emits AuthorizationManager.events#revoke
|
|
91
|
+
* @see AuthorizationManager.reset
|
|
92
|
+
*/
|
|
93
|
+
revoke(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=AuthorizationManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,KAAK,EACL,aAAa,EAId,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAGL,8BAA8B,EAC9B,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAoB;;IAG/B,aAAa,EAAE,iCAAiC,CAAC;IAIjD;;;OAGG;IACH,IAAI,aAAa,IAOQ,OAAO,CAL/B;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAG/B;IAED,MAAM,EAAE,WAAW,CAAC;IAEpB,MAAM;QACJ;;;;;;WAMG;;YAIC;;;eAGG;6BACc,OAAO;;;QAI5B;;;WAGG;;MAEH;gBAEU,aAAa,EAAE,iCAAiC;IAsB5D,gBAAgB;IAMhB,kBAAkB;IAIlB,kBAAkB;IA0BlB;;;OAGG;IACH,KAAK;IAmBL;;OAEG;IACH,KAAK;IASC,kBAAkB;IASxB;;;;;;OAMG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI;IAC5E,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,IAAI;IAyBnF;;;OAGG;IACH,oCAAoC,CAAC,QAAQ,EAAE,8BAA8B;IAe7E;;;OAGG;IACH,0BAA0B,CAAC,QAAQ,EAAE,oBAAoB;IAOzD;;;;OAIG;IACH,gBAAgB,UAAW,KAAK,GAAG,aAAa,UAM9C;IAEF;;;;OAIG;IACG,MAAM;CAIb"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _AuthorizationManager_instances, _AuthorizationManager_transport, _AuthorizationManager_authenticated, _AuthorizationManager_checkAuthorizationState, _AuthorizationManager_bootstrapFromStorageState, _AuthorizationManager_emitAuthenticatedState, _AuthorizationManager_buildTransport;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AuthorizationManager = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const index_js_1 = require("../../services/auth/index.js");
|
|
7
|
+
const index_js_2 = require("../storage/index.js");
|
|
8
|
+
const logger_js_1 = require("../logger.js");
|
|
9
|
+
const Event_js_1 = require("./Event.js");
|
|
10
|
+
const RedirectTransport_js_1 = require("./RedirectTransport.js");
|
|
11
|
+
const TokenLookup_js_1 = require("./TokenLookup.js");
|
|
12
|
+
const errors_js_1 = require("../errors.js");
|
|
13
|
+
/**
|
|
14
|
+
* @experimental
|
|
15
|
+
*/
|
|
16
|
+
class AuthorizationManager {
|
|
17
|
+
/**
|
|
18
|
+
* The `AuthorizationManager` is consdiered `authenticated` if it has a valid Globus Auth token.
|
|
19
|
+
* It does not necessarily mean that it has a valid token for a specific resource server.
|
|
20
|
+
*/
|
|
21
|
+
get authenticated() {
|
|
22
|
+
return tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_authenticated, "f");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Set the authenticated state and emit the `authenticated` event.
|
|
26
|
+
*/
|
|
27
|
+
set authenticated(value) {
|
|
28
|
+
tslib_1.__classPrivateFieldSet(this, _AuthorizationManager_authenticated, value, "f");
|
|
29
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_emitAuthenticatedState).call(this);
|
|
30
|
+
}
|
|
31
|
+
constructor(configuration) {
|
|
32
|
+
_AuthorizationManager_instances.add(this);
|
|
33
|
+
_AuthorizationManager_transport.set(this, void 0);
|
|
34
|
+
_AuthorizationManager_authenticated.set(this, false);
|
|
35
|
+
this.events = {
|
|
36
|
+
/**
|
|
37
|
+
* Emitted when the authenticated state changes.
|
|
38
|
+
* @event AuthorizationManager.events#authenticated
|
|
39
|
+
* @type {object}
|
|
40
|
+
* @property {boolean} isAuthenticated - Whether the `AuthorizationManager` is authenticated.
|
|
41
|
+
* @property {TokenResponse} [token] - The token response if the `AuthorizationManager` is authenticated.
|
|
42
|
+
*/
|
|
43
|
+
authenticated: new Event_js_1.Event('authenticated'),
|
|
44
|
+
/**
|
|
45
|
+
* Emitted when the user revokes their authentication.
|
|
46
|
+
* @event AuthorizationManager.events#revoke
|
|
47
|
+
*/
|
|
48
|
+
revoke: new Event_js_1.Event('revoke'),
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Add a Globus Auth token response to storage, if `other_tokens` are present they are also added.
|
|
52
|
+
* This method is mostly used internally by the `AuthorizationManager`, but can be used by downstream
|
|
53
|
+
* consumers to add tokens to storage if necessary.
|
|
54
|
+
*/
|
|
55
|
+
this.addTokenResponse = (token) => {
|
|
56
|
+
(0, index_js_2.getStorage)().set(`${this.configuration.client_id}:${token.resource_server}`, token);
|
|
57
|
+
if ('other_tokens' in token) {
|
|
58
|
+
token.other_tokens.forEach(this.addTokenResponse);
|
|
59
|
+
}
|
|
60
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_checkAuthorizationState).call(this);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @todo Add support for passing in an alternative storage mechanism.
|
|
64
|
+
*/
|
|
65
|
+
(0, index_js_2.createStorage)('localStorage');
|
|
66
|
+
if (!configuration.client_id) {
|
|
67
|
+
throw new Error('You must provide a `client_id` for your application.');
|
|
68
|
+
}
|
|
69
|
+
this.configuration = Object.assign(Object.assign({}, configuration), {
|
|
70
|
+
/**
|
|
71
|
+
* Inject the `openid`, `profile`, `email`, and `offline_access` scopes by default.
|
|
72
|
+
*/
|
|
73
|
+
requested_scopes: `${configuration.requested_scopes} openid profile email offline_access` });
|
|
74
|
+
this.tokens = new TokenLookup_js_1.TokenLookup({
|
|
75
|
+
manager: this,
|
|
76
|
+
});
|
|
77
|
+
this.startSilentRenew();
|
|
78
|
+
}
|
|
79
|
+
startSilentRenew() {
|
|
80
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.startSilentRenew');
|
|
81
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_bootstrapFromStorageState).call(this);
|
|
82
|
+
// @todo Iterate through all tokens and refresh them.
|
|
83
|
+
}
|
|
84
|
+
hasGlobusAuthToken() {
|
|
85
|
+
return this.getGlobusAuthToken() !== null;
|
|
86
|
+
}
|
|
87
|
+
getGlobusAuthToken() {
|
|
88
|
+
const entry = (0, index_js_2.getStorage)().get(`${this.configuration.client_id}:auth.globus.org`);
|
|
89
|
+
return entry ? JSON.parse(entry) : null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Reset the authenticated state and clear all tokens from storage.
|
|
93
|
+
* This method **does not** emit the `revoke` event. If you need to emit the `revoke` event, use the `AuthorizationManager.revoke` method.
|
|
94
|
+
*/
|
|
95
|
+
reset() {
|
|
96
|
+
/**
|
|
97
|
+
* @todo This should be made specific to the keys generated by the `AuthorizationManager`.
|
|
98
|
+
*/
|
|
99
|
+
(0, index_js_2.getStorage)().clear();
|
|
100
|
+
this.authenticated = false;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
104
|
+
*/
|
|
105
|
+
login() {
|
|
106
|
+
this.reset();
|
|
107
|
+
/**
|
|
108
|
+
* In the future, it's possible that we may want to support different types of transports.
|
|
109
|
+
*/
|
|
110
|
+
const transport = tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this);
|
|
111
|
+
transport.send();
|
|
112
|
+
}
|
|
113
|
+
handleCodeRedirect() {
|
|
114
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleCodeRedirect');
|
|
116
|
+
const response = yield tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this).getToken();
|
|
117
|
+
if ((0, index_js_1.isGlobusAuthTokenResponse)(response)) {
|
|
118
|
+
(0, logger_js_1.log)('debug', `AuthorizationManager.handleCodeRedirect | response=${response}`);
|
|
119
|
+
this.addTokenResponse(response);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
handleErrorResponse(response, execute = true) {
|
|
124
|
+
(0, logger_js_1.log)('debug', `AuthorizationManager.handleErrorResponse | response=${response} execute=${execute}`);
|
|
125
|
+
let handler = () => { };
|
|
126
|
+
if ((0, errors_js_1.isAuthorizationRequirementsError)(response)) {
|
|
127
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=AuthorizationRequirementsError');
|
|
128
|
+
handler = () => this.handleAuthorizationRequirementsError(response);
|
|
129
|
+
}
|
|
130
|
+
if ((0, errors_js_1.isConsentRequiredError)(response)) {
|
|
131
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=ConsentRequiredError');
|
|
132
|
+
handler = () => this.handleConsentRequiredError(response);
|
|
133
|
+
}
|
|
134
|
+
if ('code' in response && response['code'] === 'AuthenticationFailed') {
|
|
135
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.handleErrorResponse | error=AuthenticationFailed');
|
|
136
|
+
handler = () => this.revoke();
|
|
137
|
+
}
|
|
138
|
+
return execute === true ? handler() : handler;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
142
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
143
|
+
*/
|
|
144
|
+
handleAuthorizationRequirementsError(response) {
|
|
145
|
+
tslib_1.__classPrivateFieldSet(this, _AuthorizationManager_transport, tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
146
|
+
params: {
|
|
147
|
+
session_message: response.authorization_parameters.session_message,
|
|
148
|
+
session_required_identities: response.authorization_parameters.session_required_identities.join(','),
|
|
149
|
+
session_required_mfa: response.authorization_parameters.session_required_mfa,
|
|
150
|
+
session_required_single_domain: response.authorization_parameters.session_required_single_domain.join(','),
|
|
151
|
+
prompt: 'login',
|
|
152
|
+
},
|
|
153
|
+
}), "f");
|
|
154
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
158
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
159
|
+
*/
|
|
160
|
+
handleConsentRequiredError(response) {
|
|
161
|
+
tslib_1.__classPrivateFieldSet(this, _AuthorizationManager_transport, tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
162
|
+
requested_scopes: response.required_scopes.join(' '),
|
|
163
|
+
}), "f");
|
|
164
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Call `AuthroizationManager.reset` and emit the `revoke` event.
|
|
168
|
+
* @emits AuthorizationManager.events#revoke
|
|
169
|
+
* @see AuthorizationManager.reset
|
|
170
|
+
*/
|
|
171
|
+
revoke() {
|
|
172
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
this.reset();
|
|
174
|
+
yield this.events.revoke.dispatch();
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.AuthorizationManager = AuthorizationManager;
|
|
179
|
+
_AuthorizationManager_transport = new WeakMap(), _AuthorizationManager_authenticated = new WeakMap(), _AuthorizationManager_instances = new WeakSet(), _AuthorizationManager_checkAuthorizationState = function _AuthorizationManager_checkAuthorizationState() {
|
|
180
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.#checkAuthorizationState');
|
|
181
|
+
if (this.hasGlobusAuthToken()) {
|
|
182
|
+
this.authenticated = true;
|
|
183
|
+
}
|
|
184
|
+
}, _AuthorizationManager_bootstrapFromStorageState = function _AuthorizationManager_bootstrapFromStorageState() {
|
|
185
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
(0, logger_js_1.log)('debug', 'AuthorizationManager.bootstrapFromStorageState');
|
|
187
|
+
tslib_1.__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_checkAuthorizationState).call(this);
|
|
188
|
+
});
|
|
189
|
+
}, _AuthorizationManager_emitAuthenticatedState = function _AuthorizationManager_emitAuthenticatedState() {
|
|
190
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
var _a;
|
|
192
|
+
const isAuthenticated = this.authenticated;
|
|
193
|
+
const token = (_a = this.getGlobusAuthToken()) !== null && _a !== void 0 ? _a : undefined;
|
|
194
|
+
yield this.events.authenticated.dispatch({
|
|
195
|
+
isAuthenticated,
|
|
196
|
+
token,
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}, _AuthorizationManager_buildTransport = function _AuthorizationManager_buildTransport(overrides) {
|
|
200
|
+
return new RedirectTransport_js_1.RedirectTransport(Object.assign({ client_id: this.configuration.client_id, authorization_endpoint: (0, index_js_1.getAuthorizationEndpoint)(), token_endpoint: (0, index_js_1.getTokenEndpoint)(), redirect_uri: this.configuration.redirect_uri, requested_scopes: this.configuration.requested_scopes }, overrides));
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=AuthorizationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;;;;AAEA,2DAMsC;AAEtC,kDAAgE;AAChE,4CAAmC;AAEnC,yCAAmC;AACnC,iEAA2D;AAC3D,qDAA+C;AAE/C,4CAKsB;AA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;IACL,CAAC;wFAce,SAAuE;IACrF,OAAO,IAAI,wCAAiB,iBAC1B,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,EACvC,sBAAsB,EAAE,IAAA,mCAAwB,GAAE,EAClD,cAAc,EAAE,IAAA,2BAAgB,GAAE,EAClC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,EAC7C,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,gBAAgB,IAClD,SAAS,EACZ,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ListenerCallback<P> = (payload: P | undefined) => Promise<void> | void;
|
|
2
|
+
export declare class Event<EventName extends string, Payload extends unknown> {
|
|
3
|
+
#private;
|
|
4
|
+
readonly name: EventName;
|
|
5
|
+
constructor(name: EventName);
|
|
6
|
+
addListener(callback: ListenerCallback<Payload>): () => void;
|
|
7
|
+
removeListener(callback: ListenerCallback<Payload>): void;
|
|
8
|
+
clearListeners(): void;
|
|
9
|
+
dispatch(payload?: Payload): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/Event.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE5E,qBAAa,KAAK,CAAC,SAAS,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO;;IAGtD,QAAQ,CAAC,IAAI,EAAE,SAAS;gBAAf,IAAI,EAAE,SAAS;IAEpC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAK/C,cAAc,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAIlD,cAAc;IAIR,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;CAGjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _Event_callbacks;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Event = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
class Event {
|
|
7
|
+
constructor(name) {
|
|
8
|
+
this.name = name;
|
|
9
|
+
_Event_callbacks.set(this, []);
|
|
10
|
+
}
|
|
11
|
+
addListener(callback) {
|
|
12
|
+
tslib_1.__classPrivateFieldGet(this, _Event_callbacks, "f").push(callback);
|
|
13
|
+
return () => this.removeListener(callback);
|
|
14
|
+
}
|
|
15
|
+
removeListener(callback) {
|
|
16
|
+
tslib_1.__classPrivateFieldSet(this, _Event_callbacks, tslib_1.__classPrivateFieldGet(this, _Event_callbacks, "f").filter((cb) => cb !== callback), "f");
|
|
17
|
+
}
|
|
18
|
+
clearListeners() {
|
|
19
|
+
tslib_1.__classPrivateFieldSet(this, _Event_callbacks, [], "f");
|
|
20
|
+
}
|
|
21
|
+
dispatch(payload) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield Promise.all(tslib_1.__classPrivateFieldGet(this, _Event_callbacks, "f").map((callback) => callback(payload)));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Event = Event;
|
|
28
|
+
_Event_callbacks = new WeakMap();
|
|
29
|
+
//# sourceMappingURL=Event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/Event.ts"],"names":[],"mappings":";;;;;AAEA,MAAa,KAAK;IAGhB,YAAqB,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;QAFpC,2BAA0C,EAAE,EAAC;IAEN,CAAC;IAExC,WAAW,CAAC,QAAmC;QAC7C,+BAAA,IAAI,wBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc,CAAC,QAAmC;QAChD,+BAAA,IAAI,oBAAc,+BAAA,IAAI,wBAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAA,CAAC;IACpE,CAAC;IAED,cAAc;QACZ,+BAAA,IAAI,oBAAc,EAAE,MAAA,CAAC;IACvB,CAAC;IAEK,QAAQ,CAAC,OAAiB;;YAC9B,MAAM,OAAO,CAAC,GAAG,CAAC,+BAAA,IAAI,wBAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1E,CAAC;KAAA;CACF;AArBD,sBAqBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type IConfig from 'js-pkce/dist/IConfig';
|
|
2
|
+
import type IObject from 'js-pkce/dist/IObject';
|
|
3
|
+
export declare class RedirectTransport {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(options: IConfig & {
|
|
6
|
+
/**
|
|
7
|
+
* Additional parameters to be included in the query string of the authorization request.
|
|
8
|
+
*/
|
|
9
|
+
params?: IObject;
|
|
10
|
+
});
|
|
11
|
+
send(): void;
|
|
12
|
+
getToken(): Promise<import("js-pkce/dist/ITokenResponse").default | undefined>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=RedirectTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectTransport.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,qBAAa,iBAAiB;;gBAM1B,OAAO,EAAE,OAAO,GAAG;QACjB;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB;IAWH,IAAI;IAIE,QAAQ;CAiBf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _RedirectTransport_pkce, _RedirectTransport_params;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RedirectTransport = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const js_pkce_1 = tslib_1.__importDefault(require("js-pkce"));
|
|
7
|
+
class RedirectTransport {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
_RedirectTransport_pkce.set(this, void 0);
|
|
10
|
+
_RedirectTransport_params.set(this, {});
|
|
11
|
+
const { params } = options, config = tslib_1.__rest(options, ["params"]);
|
|
12
|
+
tslib_1.__classPrivateFieldSet(this, _RedirectTransport_pkce, new js_pkce_1.default(Object.assign({}, config)), "f");
|
|
13
|
+
tslib_1.__classPrivateFieldSet(this, _RedirectTransport_params, Object.assign({}, params), "f");
|
|
14
|
+
}
|
|
15
|
+
send() {
|
|
16
|
+
window.location.replace(tslib_1.__classPrivateFieldGet(this, _RedirectTransport_pkce, "f").authorizeUrl(tslib_1.__classPrivateFieldGet(this, _RedirectTransport_params, "f")));
|
|
17
|
+
}
|
|
18
|
+
getToken() {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const url = new URL(window.location.href);
|
|
21
|
+
const params = new URLSearchParams(url.search);
|
|
22
|
+
if (!params.get('code'))
|
|
23
|
+
return undefined;
|
|
24
|
+
const response = yield tslib_1.__classPrivateFieldGet(this, _RedirectTransport_pkce, "f").exchangeForAccessToken(url.toString());
|
|
25
|
+
params.delete('code');
|
|
26
|
+
params.delete('state');
|
|
27
|
+
url.search = params.toString();
|
|
28
|
+
/**
|
|
29
|
+
* Resets js-pkce state
|
|
30
|
+
* @see https://github.com/bpedroza/js-pkce/blob/master/src/PKCE.ts
|
|
31
|
+
*/
|
|
32
|
+
sessionStorage.removeItem('pkce_state');
|
|
33
|
+
sessionStorage.removeItem('pkce_code_verifier');
|
|
34
|
+
window.location.replace(url);
|
|
35
|
+
return response;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.RedirectTransport = RedirectTransport;
|
|
40
|
+
_RedirectTransport_pkce = new WeakMap(), _RedirectTransport_params = new WeakMap();
|
|
41
|
+
//# sourceMappingURL=RedirectTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectTransport.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":";;;;;AAAA,8DAA2B;AAI3B,MAAa,iBAAiB;IAK5B,YACE,OAKC;QAVH,0CAAY;QAEZ,oCAAmB,EAAE,EAAC;QAUpB,MAAM,EAAE,MAAM,KAAgB,OAAO,EAAlB,MAAM,kBAAK,OAAO,EAA/B,UAAqB,CAAU,CAAC;QACtC,+BAAA,IAAI,2BAAS,IAAI,iBAAI,mBAChB,MAAM,EACT,MAAA,CAAC;QACH,+BAAA,IAAI,+CACC,MAAM,OACV,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,+BAAA,IAAI,+BAAM,CAAC,YAAY,CAAC,+BAAA,IAAI,iCAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;IAEK,QAAQ;;YACZ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,OAAO,SAAS,CAAC;YAC1C,MAAM,QAAQ,GAAG,MAAM,+BAAA,IAAI,+BAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC/B;;;eAGG;YACH,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACxC,cAAc,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;YAChD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC7B,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AA3CD,8CA2CC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Token } from '../../services/auth/index.js';
|
|
2
|
+
import { AuthorizationManager } from './AuthorizationManager.js';
|
|
3
|
+
export declare class TokenLookup {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(options: {
|
|
6
|
+
manager: AuthorizationManager;
|
|
7
|
+
});
|
|
8
|
+
get auth(): Token | null;
|
|
9
|
+
get transfer(): Token | null;
|
|
10
|
+
get flows(): Token | null;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=TokenLookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenLookup.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/TokenLookup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAU,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,qBAAa,WAAW;;gBAGV,OAAO,EAAE;QAAE,OAAO,EAAE,oBAAoB,CAAA;KAAE;IAWtD,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,CAEvB;IAED,IAAI,QAAQ,IAAI,KAAK,GAAG,IAAI,CAE3B;IAED,IAAI,KAAK,IAAI,KAAK,GAAG,IAAI,CAExB;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _TokenLookup_instances, _TokenLookup_manager, _TokenLookup_getTokenForService;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TokenLookup = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const index_js_1 = require("../storage/index.js");
|
|
7
|
+
const index_js_2 = require("../../services/auth/index.js");
|
|
8
|
+
class TokenLookup {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
_TokenLookup_instances.add(this);
|
|
11
|
+
_TokenLookup_manager.set(this, void 0);
|
|
12
|
+
tslib_1.__classPrivateFieldSet(this, _TokenLookup_manager, options.manager, "f");
|
|
13
|
+
}
|
|
14
|
+
get auth() {
|
|
15
|
+
return tslib_1.__classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'AUTH');
|
|
16
|
+
}
|
|
17
|
+
get transfer() {
|
|
18
|
+
return tslib_1.__classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'TRANSFER');
|
|
19
|
+
}
|
|
20
|
+
get flows() {
|
|
21
|
+
return tslib_1.__classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'FLOWS');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.TokenLookup = TokenLookup;
|
|
25
|
+
_TokenLookup_manager = new WeakMap(), _TokenLookup_instances = new WeakSet(), _TokenLookup_getTokenForService = function _TokenLookup_getTokenForService(service) {
|
|
26
|
+
var _a;
|
|
27
|
+
const resourceServer = (_a = index_js_2.CONFIG.RESOURCE_SERVERS) === null || _a === void 0 ? void 0 : _a[service];
|
|
28
|
+
const raw = (0, index_js_1.getStorage)().get(`${tslib_1.__classPrivateFieldGet(this, _TokenLookup_manager, "f").configuration.client_id}:${resourceServer}`) || 'null';
|
|
29
|
+
return JSON.parse(raw);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=TokenLookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenLookup.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/TokenLookup.ts"],"names":[],"mappings":";;;;;AAAA,kDAAiD;AACjD,2DAA6D;AAK7D,MAAa,WAAW;IAGtB,YAAY,OAA0C;;QAFtD,uCAA+B;QAG7B,+BAAA,IAAI,wBAAY,OAAO,CAAC,OAAO,MAAA,CAAC;IAClC,CAAC;IASD,IAAI,IAAI;QACN,OAAO,+BAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,+BAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,+BAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF;AAzBD,kCAyBC;yJAlBqB,OAAwD;;IAC1E,MAAM,cAAc,GAAG,MAAA,iBAAM,CAAC,gBAAgB,0CAAG,OAAO,CAAC,CAAC;IAC1D,MAAM,GAAG,GACP,IAAA,qBAAU,GAAE,CAAC,GAAG,CAAC,GAAG,+BAAA,IAAI,4BAAS,CAAC,aAAa,CAAC,SAAS,IAAI,cAAc,EAAE,CAAC,IAAI,MAAM,CAAC;IAC3F,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuthorizationManager, type AuthorizationManagerConfiguration } from './AuthorizationManager.js';
|
|
2
|
+
import * as tokens from './tokens.js';
|
|
3
|
+
export * as tokens from './tokens.js';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated This will be removed in a future release. Use an instance of the AuthorizationManager instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTokenForScope: typeof tokens.getTokenForScope;
|
|
8
|
+
/**
|
|
9
|
+
* Create an instance of the AuthorizationManager.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
export declare function create(configuration: AuthorizationManagerConfiguration): AuthorizationManager;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,iCAAiC,EACvC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC;;GAEG;AACH,eAAO,MAAQ,gBAAgB,gCAAW,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,MAAM,CAAC,aAAa,EAAE,iCAAiC,wBAEtE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.create = exports.getTokenForScope = exports.tokens = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const AuthorizationManager_js_1 = require("./AuthorizationManager.js");
|
|
6
|
+
const tokens = tslib_1.__importStar(require("./tokens.js"));
|
|
7
|
+
exports.tokens = tslib_1.__importStar(require("./tokens.js"));
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated This will be removed in a future release. Use an instance of the AuthorizationManager instead.
|
|
10
|
+
*/
|
|
11
|
+
exports.getTokenForScope = tokens.getTokenForScope;
|
|
12
|
+
/**
|
|
13
|
+
* Create an instance of the AuthorizationManager.
|
|
14
|
+
* @experimental
|
|
15
|
+
*/
|
|
16
|
+
function create(configuration) {
|
|
17
|
+
return new AuthorizationManager_js_1.AuthorizationManager(configuration);
|
|
18
|
+
}
|
|
19
|
+
exports.create = create;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":";;;;AAAA,uEAGmC;AAEnC,4DAAsC;AAEtC,8DAAsC;AACtC;;GAEG;AACY,wBAAgB,GAAK,MAAM,kBAAC;AAE3C;;;GAGG;AACH,SAAgB,MAAM,CAAC,aAAgD;IACrE,OAAO,IAAI,8CAAoB,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Obtain the token string for the given scope.
|
|
3
|
+
* @param scope The scope string that will be used to look up the token.
|
|
4
|
+
* @returns The token string for the given scope or null if no token is found.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTokenForScope(scope: string): string | null;
|
|
7
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/tokens.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,iBAO7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTokenForScope = void 0;
|
|
4
|
+
const index_js_1 = require("../storage/index.js");
|
|
5
|
+
function isValidToken(check) {
|
|
6
|
+
const maybe = check;
|
|
7
|
+
return Boolean(maybe.token_type && maybe.access_token);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Obtain the token string for the given scope.
|
|
11
|
+
* @param scope The scope string that will be used to look up the token.
|
|
12
|
+
* @returns The token string for the given scope or null if no token is found.
|
|
13
|
+
*/
|
|
14
|
+
function getTokenForScope(scope) {
|
|
15
|
+
const storageValue = (0, index_js_1.getStorage)().get(scope);
|
|
16
|
+
const token = storageValue ? JSON.parse(storageValue) : null;
|
|
17
|
+
if (!token || !isValidToken(token)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return `${token.token_type} ${token.access_token}`;
|
|
21
|
+
}
|
|
22
|
+
exports.getTokenForScope = getTokenForScope;
|
|
23
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/tokens.ts"],"names":[],"mappings":";;;AAEA,kDAAiD;AAEjD,SAAS,YAAY,CAAC,KAAc;IAClC,MAAM,KAAK,GAAG,KAAc,CAAC;IAC7B,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,MAAM,YAAY,GAAG,IAAA,qBAAU,GAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;AACrD,CAAC;AAPD,4CAOC"}
|