@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
|
@@ -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,198 @@
|
|
|
1
|
+
var _AuthorizationManager_instances, _AuthorizationManager_transport, _AuthorizationManager_authenticated, _AuthorizationManager_checkAuthorizationState, _AuthorizationManager_bootstrapFromStorageState, _AuthorizationManager_emitAuthenticatedState, _AuthorizationManager_buildTransport;
|
|
2
|
+
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { getAuthorizationEndpoint, getTokenEndpoint, isGlobusAuthTokenResponse, } from '../../services/auth/index.js';
|
|
4
|
+
import { createStorage, getStorage } from '../storage/index.js';
|
|
5
|
+
import { log } from '../logger.js';
|
|
6
|
+
import { Event } from './Event.js';
|
|
7
|
+
import { RedirectTransport } from './RedirectTransport.js';
|
|
8
|
+
import { TokenLookup } from './TokenLookup.js';
|
|
9
|
+
import { isConsentRequiredError, isAuthorizationRequirementsError, } from '../errors.js';
|
|
10
|
+
/**
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
export class AuthorizationManager {
|
|
14
|
+
/**
|
|
15
|
+
* The `AuthorizationManager` is consdiered `authenticated` if it has a valid Globus Auth token.
|
|
16
|
+
* It does not necessarily mean that it has a valid token for a specific resource server.
|
|
17
|
+
*/
|
|
18
|
+
get authenticated() {
|
|
19
|
+
return __classPrivateFieldGet(this, _AuthorizationManager_authenticated, "f");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Set the authenticated state and emit the `authenticated` event.
|
|
23
|
+
*/
|
|
24
|
+
set authenticated(value) {
|
|
25
|
+
__classPrivateFieldSet(this, _AuthorizationManager_authenticated, value, "f");
|
|
26
|
+
__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_emitAuthenticatedState).call(this);
|
|
27
|
+
}
|
|
28
|
+
constructor(configuration) {
|
|
29
|
+
_AuthorizationManager_instances.add(this);
|
|
30
|
+
_AuthorizationManager_transport.set(this, void 0);
|
|
31
|
+
_AuthorizationManager_authenticated.set(this, false);
|
|
32
|
+
this.events = {
|
|
33
|
+
/**
|
|
34
|
+
* Emitted when the authenticated state changes.
|
|
35
|
+
* @event AuthorizationManager.events#authenticated
|
|
36
|
+
* @type {object}
|
|
37
|
+
* @property {boolean} isAuthenticated - Whether the `AuthorizationManager` is authenticated.
|
|
38
|
+
* @property {TokenResponse} [token] - The token response if the `AuthorizationManager` is authenticated.
|
|
39
|
+
*/
|
|
40
|
+
authenticated: new Event('authenticated'),
|
|
41
|
+
/**
|
|
42
|
+
* Emitted when the user revokes their authentication.
|
|
43
|
+
* @event AuthorizationManager.events#revoke
|
|
44
|
+
*/
|
|
45
|
+
revoke: new Event('revoke'),
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Add a Globus Auth token response to storage, if `other_tokens` are present they are also added.
|
|
49
|
+
* This method is mostly used internally by the `AuthorizationManager`, but can be used by downstream
|
|
50
|
+
* consumers to add tokens to storage if necessary.
|
|
51
|
+
*/
|
|
52
|
+
this.addTokenResponse = (token) => {
|
|
53
|
+
getStorage().set(`${this.configuration.client_id}:${token.resource_server}`, token);
|
|
54
|
+
if ('other_tokens' in token) {
|
|
55
|
+
token.other_tokens.forEach(this.addTokenResponse);
|
|
56
|
+
}
|
|
57
|
+
__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_checkAuthorizationState).call(this);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @todo Add support for passing in an alternative storage mechanism.
|
|
61
|
+
*/
|
|
62
|
+
createStorage('localStorage');
|
|
63
|
+
if (!configuration.client_id) {
|
|
64
|
+
throw new Error('You must provide a `client_id` for your application.');
|
|
65
|
+
}
|
|
66
|
+
this.configuration = Object.assign(Object.assign({}, configuration), {
|
|
67
|
+
/**
|
|
68
|
+
* Inject the `openid`, `profile`, `email`, and `offline_access` scopes by default.
|
|
69
|
+
*/
|
|
70
|
+
requested_scopes: `${configuration.requested_scopes} openid profile email offline_access` });
|
|
71
|
+
this.tokens = new TokenLookup({
|
|
72
|
+
manager: this,
|
|
73
|
+
});
|
|
74
|
+
this.startSilentRenew();
|
|
75
|
+
}
|
|
76
|
+
startSilentRenew() {
|
|
77
|
+
log('debug', 'AuthorizationManager.startSilentRenew');
|
|
78
|
+
__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_bootstrapFromStorageState).call(this);
|
|
79
|
+
// @todo Iterate through all tokens and refresh them.
|
|
80
|
+
}
|
|
81
|
+
hasGlobusAuthToken() {
|
|
82
|
+
return this.getGlobusAuthToken() !== null;
|
|
83
|
+
}
|
|
84
|
+
getGlobusAuthToken() {
|
|
85
|
+
const entry = getStorage().get(`${this.configuration.client_id}:auth.globus.org`);
|
|
86
|
+
return entry ? JSON.parse(entry) : null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Reset the authenticated state and clear all tokens from storage.
|
|
90
|
+
* This method **does not** emit the `revoke` event. If you need to emit the `revoke` event, use the `AuthorizationManager.revoke` method.
|
|
91
|
+
*/
|
|
92
|
+
reset() {
|
|
93
|
+
/**
|
|
94
|
+
* @todo This should be made specific to the keys generated by the `AuthorizationManager`.
|
|
95
|
+
*/
|
|
96
|
+
getStorage().clear();
|
|
97
|
+
this.authenticated = false;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Initiate the login process by redirecting to the Globus Auth login page.
|
|
101
|
+
*/
|
|
102
|
+
login() {
|
|
103
|
+
this.reset();
|
|
104
|
+
/**
|
|
105
|
+
* In the future, it's possible that we may want to support different types of transports.
|
|
106
|
+
*/
|
|
107
|
+
const transport = __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this);
|
|
108
|
+
transport.send();
|
|
109
|
+
}
|
|
110
|
+
handleCodeRedirect() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
log('debug', 'AuthorizationManager.handleCodeRedirect');
|
|
113
|
+
const response = yield __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this).getToken();
|
|
114
|
+
if (isGlobusAuthTokenResponse(response)) {
|
|
115
|
+
log('debug', `AuthorizationManager.handleCodeRedirect | response=${response}`);
|
|
116
|
+
this.addTokenResponse(response);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
handleErrorResponse(response, execute = true) {
|
|
121
|
+
log('debug', `AuthorizationManager.handleErrorResponse | response=${response} execute=${execute}`);
|
|
122
|
+
let handler = () => { };
|
|
123
|
+
if (isAuthorizationRequirementsError(response)) {
|
|
124
|
+
log('debug', 'AuthorizationManager.handleErrorResponse | error=AuthorizationRequirementsError');
|
|
125
|
+
handler = () => this.handleAuthorizationRequirementsError(response);
|
|
126
|
+
}
|
|
127
|
+
if (isConsentRequiredError(response)) {
|
|
128
|
+
log('debug', 'AuthorizationManager.handleErrorResponse | error=ConsentRequiredError');
|
|
129
|
+
handler = () => this.handleConsentRequiredError(response);
|
|
130
|
+
}
|
|
131
|
+
if ('code' in response && response['code'] === 'AuthenticationFailed') {
|
|
132
|
+
log('debug', 'AuthorizationManager.handleErrorResponse | error=AuthenticationFailed');
|
|
133
|
+
handler = () => this.revoke();
|
|
134
|
+
}
|
|
135
|
+
return execute === true ? handler() : handler;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Process a well-formed Authorization Requirements error response from a Globus service
|
|
139
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
140
|
+
*/
|
|
141
|
+
handleAuthorizationRequirementsError(response) {
|
|
142
|
+
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
143
|
+
params: {
|
|
144
|
+
session_message: response.authorization_parameters.session_message,
|
|
145
|
+
session_required_identities: response.authorization_parameters.session_required_identities.join(','),
|
|
146
|
+
session_required_mfa: response.authorization_parameters.session_required_mfa,
|
|
147
|
+
session_required_single_domain: response.authorization_parameters.session_required_single_domain.join(','),
|
|
148
|
+
prompt: 'login',
|
|
149
|
+
},
|
|
150
|
+
}), "f");
|
|
151
|
+
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Process a well-formed `ConsentRequired` error response from a Globus service
|
|
155
|
+
* and redirect the user to the Globus Auth login page with the necessary parameters.
|
|
156
|
+
*/
|
|
157
|
+
handleConsentRequiredError(response) {
|
|
158
|
+
__classPrivateFieldSet(this, _AuthorizationManager_transport, __classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_buildTransport).call(this, {
|
|
159
|
+
requested_scopes: response.required_scopes.join(' '),
|
|
160
|
+
}), "f");
|
|
161
|
+
__classPrivateFieldGet(this, _AuthorizationManager_transport, "f").send();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Call `AuthroizationManager.reset` and emit the `revoke` event.
|
|
165
|
+
* @emits AuthorizationManager.events#revoke
|
|
166
|
+
* @see AuthorizationManager.reset
|
|
167
|
+
*/
|
|
168
|
+
revoke() {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
this.reset();
|
|
171
|
+
yield this.events.revoke.dispatch();
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
_AuthorizationManager_transport = new WeakMap(), _AuthorizationManager_authenticated = new WeakMap(), _AuthorizationManager_instances = new WeakSet(), _AuthorizationManager_checkAuthorizationState = function _AuthorizationManager_checkAuthorizationState() {
|
|
176
|
+
log('debug', 'AuthorizationManager.#checkAuthorizationState');
|
|
177
|
+
if (this.hasGlobusAuthToken()) {
|
|
178
|
+
this.authenticated = true;
|
|
179
|
+
}
|
|
180
|
+
}, _AuthorizationManager_bootstrapFromStorageState = function _AuthorizationManager_bootstrapFromStorageState() {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
log('debug', 'AuthorizationManager.bootstrapFromStorageState');
|
|
183
|
+
__classPrivateFieldGet(this, _AuthorizationManager_instances, "m", _AuthorizationManager_checkAuthorizationState).call(this);
|
|
184
|
+
});
|
|
185
|
+
}, _AuthorizationManager_emitAuthenticatedState = function _AuthorizationManager_emitAuthenticatedState() {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
var _a;
|
|
188
|
+
const isAuthenticated = this.authenticated;
|
|
189
|
+
const token = (_a = this.getGlobusAuthToken()) !== null && _a !== void 0 ? _a : undefined;
|
|
190
|
+
yield this.events.authenticated.dispatch({
|
|
191
|
+
isAuthenticated,
|
|
192
|
+
token,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}, _AuthorizationManager_buildTransport = function _AuthorizationManager_buildTransport(overrides) {
|
|
196
|
+
return new RedirectTransport(Object.assign({ client_id: this.configuration.client_id, authorization_endpoint: getAuthorizationEndpoint(), token_endpoint: getTokenEndpoint(), redirect_uri: this.configuration.redirect_uri, requested_scopes: this.configuration.requested_scopes }, overrides));
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=AuthorizationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthorizationManager.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/AuthorizationManager.ts"],"names":[],"mappings":";;AAEA,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,sBAAsB,EACtB,gCAAgC,GAGjC,MAAM,cAAc,CAAC;AAQtB;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAO/B;;;OAGG;IACH,IAAI,aAAa;QACf,OAAO,uBAAA,IAAI,2CAAe,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,KAAc;QAC9B,uBAAA,IAAI,uCAAkB,KAA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
|
|
@@ -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,25 @@
|
|
|
1
|
+
var _Event_callbacks;
|
|
2
|
+
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
export class Event {
|
|
4
|
+
constructor(name) {
|
|
5
|
+
this.name = name;
|
|
6
|
+
_Event_callbacks.set(this, []);
|
|
7
|
+
}
|
|
8
|
+
addListener(callback) {
|
|
9
|
+
__classPrivateFieldGet(this, _Event_callbacks, "f").push(callback);
|
|
10
|
+
return () => this.removeListener(callback);
|
|
11
|
+
}
|
|
12
|
+
removeListener(callback) {
|
|
13
|
+
__classPrivateFieldSet(this, _Event_callbacks, __classPrivateFieldGet(this, _Event_callbacks, "f").filter((cb) => cb !== callback), "f");
|
|
14
|
+
}
|
|
15
|
+
clearListeners() {
|
|
16
|
+
__classPrivateFieldSet(this, _Event_callbacks, [], "f");
|
|
17
|
+
}
|
|
18
|
+
dispatch(payload) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield Promise.all(__classPrivateFieldGet(this, _Event_callbacks, "f").map((callback) => callback(payload)));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
_Event_callbacks = new WeakMap();
|
|
25
|
+
//# sourceMappingURL=Event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/Event.ts"],"names":[],"mappings":";;AAEA,MAAM,OAAO,KAAK;IAGhB,YAAqB,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;QAFpC,2BAA0C,EAAE,EAAC;IAEN,CAAC;IAExC,WAAW,CAAC,QAAmC;QAC7C,uBAAA,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,uBAAA,IAAI,oBAAc,uBAAA,IAAI,wBAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,MAAA,CAAC;IACpE,CAAC;IAED,cAAc;QACZ,uBAAA,IAAI,oBAAc,EAAE,MAAA,CAAC;IACvB,CAAC;IAEK,QAAQ,CAAC,OAAiB;;YAC9B,MAAM,OAAO,CAAC,GAAG,CAAC,uBAAA,IAAI,wBAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1E,CAAC;KAAA;CACF"}
|
|
@@ -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,37 @@
|
|
|
1
|
+
var _RedirectTransport_pkce, _RedirectTransport_params;
|
|
2
|
+
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet, __rest } from "tslib";
|
|
3
|
+
import PKCE from 'js-pkce';
|
|
4
|
+
export class RedirectTransport {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
_RedirectTransport_pkce.set(this, void 0);
|
|
7
|
+
_RedirectTransport_params.set(this, {});
|
|
8
|
+
const { params } = options, config = __rest(options, ["params"]);
|
|
9
|
+
__classPrivateFieldSet(this, _RedirectTransport_pkce, new PKCE(Object.assign({}, config)), "f");
|
|
10
|
+
__classPrivateFieldSet(this, _RedirectTransport_params, Object.assign({}, params), "f");
|
|
11
|
+
}
|
|
12
|
+
send() {
|
|
13
|
+
window.location.replace(__classPrivateFieldGet(this, _RedirectTransport_pkce, "f").authorizeUrl(__classPrivateFieldGet(this, _RedirectTransport_params, "f")));
|
|
14
|
+
}
|
|
15
|
+
getToken() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const url = new URL(window.location.href);
|
|
18
|
+
const params = new URLSearchParams(url.search);
|
|
19
|
+
if (!params.get('code'))
|
|
20
|
+
return undefined;
|
|
21
|
+
const response = yield __classPrivateFieldGet(this, _RedirectTransport_pkce, "f").exchangeForAccessToken(url.toString());
|
|
22
|
+
params.delete('code');
|
|
23
|
+
params.delete('state');
|
|
24
|
+
url.search = params.toString();
|
|
25
|
+
/**
|
|
26
|
+
* Resets js-pkce state
|
|
27
|
+
* @see https://github.com/bpedroza/js-pkce/blob/master/src/PKCE.ts
|
|
28
|
+
*/
|
|
29
|
+
sessionStorage.removeItem('pkce_state');
|
|
30
|
+
sessionStorage.removeItem('pkce_code_verifier');
|
|
31
|
+
window.location.replace(url);
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_RedirectTransport_pkce = new WeakMap(), _RedirectTransport_params = new WeakMap();
|
|
37
|
+
//# sourceMappingURL=RedirectTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectTransport.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/RedirectTransport.ts"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAI3B,MAAM,OAAO,iBAAiB;IAK5B,YACE,OAKC;QAVH,0CAAY;QAEZ,oCAAmB,EAAE,EAAC;QAUpB,MAAM,EAAE,MAAM,KAAgB,OAAO,EAAlB,MAAM,UAAK,OAAO,EAA/B,UAAqB,CAAU,CAAC;QACtC,uBAAA,IAAI,2BAAS,IAAI,IAAI,mBAChB,MAAM,EACT,MAAA,CAAC;QACH,uBAAA,IAAI,+CACC,MAAM,OACV,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,uBAAA,IAAI,+BAAM,CAAC,YAAY,CAAC,uBAAA,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,uBAAA,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"}
|
|
@@ -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,27 @@
|
|
|
1
|
+
var _TokenLookup_instances, _TokenLookup_manager, _TokenLookup_getTokenForService;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { getStorage } from '../storage/index.js';
|
|
4
|
+
import { CONFIG } from '../../services/auth/index.js';
|
|
5
|
+
export class TokenLookup {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
_TokenLookup_instances.add(this);
|
|
8
|
+
_TokenLookup_manager.set(this, void 0);
|
|
9
|
+
__classPrivateFieldSet(this, _TokenLookup_manager, options.manager, "f");
|
|
10
|
+
}
|
|
11
|
+
get auth() {
|
|
12
|
+
return __classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'AUTH');
|
|
13
|
+
}
|
|
14
|
+
get transfer() {
|
|
15
|
+
return __classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'TRANSFER');
|
|
16
|
+
}
|
|
17
|
+
get flows() {
|
|
18
|
+
return __classPrivateFieldGet(this, _TokenLookup_instances, "m", _TokenLookup_getTokenForService).call(this, 'FLOWS');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
_TokenLookup_manager = new WeakMap(), _TokenLookup_instances = new WeakSet(), _TokenLookup_getTokenForService = function _TokenLookup_getTokenForService(service) {
|
|
22
|
+
var _a;
|
|
23
|
+
const resourceServer = (_a = CONFIG.RESOURCE_SERVERS) === null || _a === void 0 ? void 0 : _a[service];
|
|
24
|
+
const raw = getStorage().get(`${__classPrivateFieldGet(this, _TokenLookup_manager, "f").configuration.client_id}:${resourceServer}`) || 'null';
|
|
25
|
+
return JSON.parse(raw);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=TokenLookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenLookup.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/TokenLookup.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAS,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAK7D,MAAM,OAAO,WAAW;IAGtB,YAAY,OAA0C;;QAFtD,uCAA+B;QAG7B,uBAAA,IAAI,wBAAY,OAAO,CAAC,OAAO,MAAA,CAAC;IAClC,CAAC;IASD,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,uBAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,uBAAA,IAAI,+DAAoB,MAAxB,IAAI,EAAqB,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF;yJAlBqB,OAAwD;;IAC1E,MAAM,cAAc,GAAG,MAAA,MAAM,CAAC,gBAAgB,0CAAG,OAAO,CAAC,CAAC;IAC1D,MAAM,GAAG,GACP,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,uBAAA,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,15 @@
|
|
|
1
|
+
import { AuthorizationManager, } 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 const { getTokenForScope } = tokens;
|
|
8
|
+
/**
|
|
9
|
+
* Create an instance of the AuthorizationManager.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
export function create(configuration) {
|
|
13
|
+
return new AuthorizationManager(configuration);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC;;GAEG;AACH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,aAAgD;IACrE,OAAO,IAAI,oBAAoB,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -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,19 @@
|
|
|
1
|
+
import { getStorage } from '../storage/index.js';
|
|
2
|
+
function isValidToken(check) {
|
|
3
|
+
const maybe = check;
|
|
4
|
+
return Boolean(maybe.token_type && maybe.access_token);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Obtain the token string for the given scope.
|
|
8
|
+
* @param scope The scope string that will be used to look up the token.
|
|
9
|
+
* @returns The token string for the given scope or null if no token is found.
|
|
10
|
+
*/
|
|
11
|
+
export function getTokenForScope(scope) {
|
|
12
|
+
const storageValue = getStorage().get(scope);
|
|
13
|
+
const token = storageValue ? JSON.parse(storageValue) : null;
|
|
14
|
+
if (!token || !isValidToken(token)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return `${token.token_type} ${token.access_token}`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../src/lib/core/authorization/tokens.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;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,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,YAAY,GAAG,UAAU,EAAE,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"}
|
package/esm/lib/core/errors.d.ts
CHANGED
|
@@ -2,4 +2,25 @@ export declare class EnvironmentConfigurationError extends Error {
|
|
|
2
2
|
name: string;
|
|
3
3
|
constructor(variable: string, value: unknown);
|
|
4
4
|
}
|
|
5
|
+
export type WellFormedError = {
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function isErrorWellFormed(test: unknown): test is WellFormedError;
|
|
10
|
+
export type ConsentRequiredError = {
|
|
11
|
+
code: 'ConsentRequired';
|
|
12
|
+
required_scopes: string[];
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
export declare function isConsentRequiredError(test: unknown): test is ConsentRequiredError;
|
|
16
|
+
export type AuthorizationRequirementsError = {
|
|
17
|
+
authorization_parameters: {
|
|
18
|
+
session_message: string;
|
|
19
|
+
session_required_identities: string[];
|
|
20
|
+
session_required_mfa: boolean;
|
|
21
|
+
session_required_single_domain: string[];
|
|
22
|
+
};
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
export declare function isAuthorizationRequirementsError(test: unknown): test is AuthorizationRequirementsError;
|
|
5
26
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,SAAmC;gBAEpC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAK7C"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,6BAA8B,SAAQ,KAAK;IAC7C,IAAI,SAAmC;gBAEpC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAK7C;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAExE;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAOlF;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wBAAwB,EAAE;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,2BAA2B,EAAE,MAAM,EAAE,CAAC;QACtC,oBAAoB,EAAE,OAAO,CAAC;QAC9B,8BAA8B,EAAE,MAAM,EAAE,CAAC;KAC1C,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,8BAA8B,CAOxC"}
|
package/esm/lib/core/errors.js
CHANGED
|
@@ -6,4 +6,19 @@ export class EnvironmentConfigurationError extends Error {
|
|
|
6
6
|
this.message = `Invalid configuration value provided for ${variable} (${value}).`;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
export function isErrorWellFormed(test) {
|
|
10
|
+
return typeof test === 'object' && test !== null && 'code' in test && 'message' in test;
|
|
11
|
+
}
|
|
12
|
+
export function isConsentRequiredError(test) {
|
|
13
|
+
return (isErrorWellFormed(test) &&
|
|
14
|
+
test.code === 'ConsentRequired' &&
|
|
15
|
+
'required_scopes' in test &&
|
|
16
|
+
Array.isArray(test.required_scopes));
|
|
17
|
+
}
|
|
18
|
+
export function isAuthorizationRequirementsError(test) {
|
|
19
|
+
return (isErrorWellFormed(test) &&
|
|
20
|
+
'authorization_parameters' in test &&
|
|
21
|
+
typeof test.authorization_parameters === 'object' &&
|
|
22
|
+
test.authorization_parameters !== null);
|
|
23
|
+
}
|
|
9
24
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAGtD,YAAY,QAAgB,EAAE,KAAc;QAC1C,KAAK,EAAE,CAAC;QAHD,SAAI,GAAG,+BAA+B,CAAC;QAI9C,4EAA4E;QAC5E,IAAI,CAAC,OAAO,GAAG,4CAA4C,QAAQ,KAAK,KAAK,IAAI,CAAC;IACpF,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAGtD,YAAY,QAAgB,EAAE,KAAc;QAC1C,KAAK,EAAE,CAAC;QAHD,SAAI,GAAG,+BAA+B,CAAC;QAI9C,4EAA4E;QAC5E,IAAI,CAAC,OAAO,GAAG,4CAA4C,QAAQ,KAAK,KAAK,IAAI,CAAC;IACpF,CAAC;CACF;AAOD,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,CAAC;AAC1F,CAAC;AAQD,MAAM,UAAU,sBAAsB,CAAC,IAAa;IAClD,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,KAAK,iBAAiB;QAC/B,iBAAiB,IAAI,IAAI;QACzB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CACpC,CAAC;AACJ,CAAC;AAYD,MAAM,UAAU,gCAAgC,CAC9C,IAAa;IAEb,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC;QACvB,0BAA0B,IAAI,IAAI;QAClC,OAAO,IAAI,CAAC,wBAAwB,KAAK,QAAQ;QACjD,IAAI,CAAC,wBAAwB,KAAK,IAAI,CACvC,CAAC;AACJ,CAAC"}
|
package/esm/lib/core/global.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare function getSDKOptions(options?: SDKOptions): {
|
|
|
40
40
|
keepalive?: boolean | undefined;
|
|
41
41
|
method?: string | undefined;
|
|
42
42
|
mode?: RequestMode | undefined;
|
|
43
|
+
priority?: RequestPriority | undefined;
|
|
43
44
|
redirect?: RequestRedirect | undefined;
|
|
44
45
|
referrer?: string | undefined;
|
|
45
46
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
@@ -64,5 +65,6 @@ export declare function getVerifySSL(): boolean;
|
|
|
64
65
|
* Handlers for: GLOBUS_SDK_HTTP_TIMEOUT
|
|
65
66
|
*/
|
|
66
67
|
export declare function getHttpTimeout(): number | null;
|
|
68
|
+
export declare function getServiceHost(service: Service, environment?: Environment): string | undefined;
|
|
67
69
|
export declare function getServiceBaseUrl(service: Service, environment?: Environment): string | undefined;
|
|
68
70
|
//# sourceMappingURL=global.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/global.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAwBlD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E,wBAAgB,cAAc,IAAI,WAAW,CAM5C;AAED,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,OA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