@asgardeo/javascript 0.0.1
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/LICENSE +201 -0
- package/README.md +57 -0
- package/dist/AsgardeoJavaScriptClient.d.ts +81 -0
- package/dist/IsomorphicCrypto.d.ts +73 -0
- package/dist/__legacy__/client.d.ts +488 -0
- package/dist/__legacy__/core/authentication-core.d.ts +51 -0
- package/dist/__legacy__/core/index.d.ts +18 -0
- package/dist/__legacy__/data/data-layer.d.ts +64 -0
- package/dist/__legacy__/data/index.d.ts +18 -0
- package/dist/__legacy__/exception/exception.d.ts +23 -0
- package/dist/__legacy__/exception/index.d.ts +18 -0
- package/dist/__legacy__/helpers/authentication-helper.d.ts +37 -0
- package/dist/__legacy__/helpers/index.d.ts +18 -0
- package/dist/__legacy__/models/authorization-url.d.ts +23 -0
- package/dist/__legacy__/models/client-config.d.ts +60 -0
- package/dist/__legacy__/models/custom-grant.d.ts +26 -0
- package/dist/__legacy__/models/data.d.ts +27 -0
- package/dist/__legacy__/models/fetch.d.ts +55 -0
- package/dist/__legacy__/models/index.d.ts +23 -0
- package/dist/__legacy__/models/user.d.ts +85 -0
- package/dist/api/oidc/getUserInfo.d.ts +37 -0
- package/dist/cjs/index.js +2227 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/constants/OIDCDiscoveryConstants.d.ts +153 -0
- package/dist/constants/OIDCRequestConstants.d.ts +66 -0
- package/dist/constants/PKCEConstants.d.ts +58 -0
- package/dist/constants/ScopeConstants.d.ts +45 -0
- package/dist/constants/TokenConstants.d.ts +76 -0
- package/dist/constants/TokenExchangeConstants.d.ts +68 -0
- package/dist/errors/AsgardeoAPIError.d.ts +52 -0
- package/dist/errors/AsgardeoError.d.ts +49 -0
- package/dist/errors/AsgardeoRuntimeError.d.ts +50 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +2186 -0
- package/dist/index.js.map +7 -0
- package/dist/models/client.d.ts +84 -0
- package/dist/models/config.d.ts +81 -0
- package/dist/models/crypto.d.ts +100 -0
- package/dist/models/id-token.d.ts +55 -0
- package/dist/models/oauth-response.d.ts +34 -0
- package/dist/models/oidc-discovery.d.ts +369 -0
- package/dist/models/oidc-endpoints.d.ts +70 -0
- package/dist/models/scim2-schema.d.ts +62 -0
- package/dist/models/store.d.ts +81 -0
- package/dist/models/token.d.ts +121 -0
- package/dist/models/user.d.ts +106 -0
- package/dist/models/utility-types.d.ts +20 -0
- package/dist/theme/createTheme.d.ts +21 -0
- package/dist/theme/types.d.ts +59 -0
- package/dist/utils/cryptoUtils.d.ts +0 -0
- package/dist/utils/extractPkceStorageKeyFromState.d.ts +32 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +31 -0
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +44 -0
- package/dist/utils/generatePkceStorageKey.d.ts +34 -0
- package/dist/utils/generateStateParamForRequestCorrelation.d.ts +34 -0
- package/dist/utils/removeTrailingSlash.d.ts +31 -0
- package/package.json +61 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { IsomorphicCrypto } from '../../IsomorphicCrypto';
|
|
19
|
+
import { DataLayer } from '../data';
|
|
20
|
+
import { AuthenticatedUserInfo } from '../models';
|
|
21
|
+
import { TokenResponse } from '../../models/token';
|
|
22
|
+
import { OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse } from '../../models/oidc-discovery';
|
|
23
|
+
export declare class AuthenticationHelper<T> {
|
|
24
|
+
private _dataLayer;
|
|
25
|
+
private _config;
|
|
26
|
+
private _oidcProviderMetaData;
|
|
27
|
+
private _cryptoHelper;
|
|
28
|
+
constructor(dataLayer: DataLayer<T>, cryptoHelper: IsomorphicCrypto);
|
|
29
|
+
resolveEndpoints(response: OIDCDiscoveryApiResponse): Promise<OIDCDiscoveryApiResponse>;
|
|
30
|
+
resolveEndpointsExplicitly(): Promise<OIDCDiscoveryEndpointsApiResponse>;
|
|
31
|
+
resolveEndpointsByBaseURL(): Promise<OIDCDiscoveryEndpointsApiResponse>;
|
|
32
|
+
validateIdToken(idToken: string): Promise<boolean>;
|
|
33
|
+
getAuthenticatedUserInfo(idToken: string): AuthenticatedUserInfo;
|
|
34
|
+
replaceCustomGrantTemplateTags(text: string, userID?: string): Promise<string>;
|
|
35
|
+
clearUserSessionData(userID?: string): Promise<void>;
|
|
36
|
+
handleTokenResponse(response: Response, userID?: string): Promise<TokenResponse>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from './authentication-helper';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export type AuthorizationURLParams = Omit<GetAuthURLConfig, "forceInit">;
|
|
19
|
+
export interface StrictGetAuthURLConfig {
|
|
20
|
+
fidp?: string;
|
|
21
|
+
forceInit?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type GetAuthURLConfig = StrictGetAuthURLConfig & Record<string, string | boolean>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ResponseMode } from '../../models/oauth-response';
|
|
19
|
+
import { OIDCEndpoints } from '../../models/oidc-endpoints';
|
|
20
|
+
export interface DefaultAuthClientConfig {
|
|
21
|
+
signInRedirectURL: string;
|
|
22
|
+
signOutRedirectURL?: string;
|
|
23
|
+
clientHost?: string;
|
|
24
|
+
clientID: string;
|
|
25
|
+
clientSecret?: string;
|
|
26
|
+
enablePKCE?: boolean;
|
|
27
|
+
prompt?: string;
|
|
28
|
+
responseMode?: ResponseMode;
|
|
29
|
+
scope?: string[];
|
|
30
|
+
validateIDToken?: boolean;
|
|
31
|
+
validateIDTokenIssuer?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Allowed leeway for id_tokens (in seconds).
|
|
34
|
+
*/
|
|
35
|
+
clockTolerance?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies if cookies should be sent with access-token requests, refresh-token requests,
|
|
38
|
+
* custom-grant requests, etc.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
sendCookiesInRequests?: boolean;
|
|
42
|
+
sendIdTokenInLogoutRequest?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface WellKnownAuthClientConfig extends DefaultAuthClientConfig {
|
|
45
|
+
wellKnownEndpoint: string;
|
|
46
|
+
endpoints?: Partial<OIDCEndpoints>;
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface BaseURLAuthClientConfig extends DefaultAuthClientConfig {
|
|
50
|
+
baseUrl: string;
|
|
51
|
+
endpoints?: Partial<OIDCEndpoints>;
|
|
52
|
+
wellKnownEndpoint?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ExplicitAuthClientConfig extends DefaultAuthClientConfig {
|
|
55
|
+
endpoints: OIDCEndpoints;
|
|
56
|
+
baseUrl?: string;
|
|
57
|
+
wellKnownEndpoint?: string;
|
|
58
|
+
}
|
|
59
|
+
export type StrictAuthClientConfig = WellKnownAuthClientConfig | BaseURLAuthClientConfig | ExplicitAuthClientConfig;
|
|
60
|
+
export type AuthClientConfig<T = unknown> = StrictAuthClientConfig & T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export interface CustomGrantConfig {
|
|
19
|
+
id: string;
|
|
20
|
+
data: any;
|
|
21
|
+
signInRequired: boolean;
|
|
22
|
+
attachToken: boolean;
|
|
23
|
+
returnsSession: boolean;
|
|
24
|
+
tokenEndpoint?: string;
|
|
25
|
+
shouldReplayAfterRefresh?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export interface SessionData {
|
|
19
|
+
access_token: string;
|
|
20
|
+
id_token: string;
|
|
21
|
+
expires_in: string;
|
|
22
|
+
scope: string;
|
|
23
|
+
refresh_token?: string;
|
|
24
|
+
token_type: string;
|
|
25
|
+
session_state: string;
|
|
26
|
+
created_at: number;
|
|
27
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export type Method = "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "purge" | "PURGE" | "link" | "LINK" | "unlink" | "UNLINK";
|
|
19
|
+
export type FetchCredentials = "omit" | "same-origin" | "include";
|
|
20
|
+
export type FetchRedirect = "follow" | "error" | "manual";
|
|
21
|
+
export interface FetchRequestConfig extends RequestInit {
|
|
22
|
+
method?: Method;
|
|
23
|
+
url?: string;
|
|
24
|
+
credentials?: FetchCredentials;
|
|
25
|
+
body?: any;
|
|
26
|
+
bodyUsed?: boolean;
|
|
27
|
+
cache?: any;
|
|
28
|
+
destination?: string;
|
|
29
|
+
integrity?: string;
|
|
30
|
+
mode?: any;
|
|
31
|
+
redirect?: FetchRedirect;
|
|
32
|
+
referrer?: string;
|
|
33
|
+
referrerPolicy?: any;
|
|
34
|
+
}
|
|
35
|
+
export interface FetchResponse<T = any> extends ResponseInit {
|
|
36
|
+
body: T;
|
|
37
|
+
ok: boolean;
|
|
38
|
+
bodyUsed?: boolean;
|
|
39
|
+
redirected?: boolean;
|
|
40
|
+
type: any;
|
|
41
|
+
url: string;
|
|
42
|
+
json(): any;
|
|
43
|
+
text(): any;
|
|
44
|
+
formData(): any;
|
|
45
|
+
blob(): any;
|
|
46
|
+
arrayBuffer(): any;
|
|
47
|
+
}
|
|
48
|
+
export interface FetchError<T = any> extends Error {
|
|
49
|
+
config: FetchRequestConfig;
|
|
50
|
+
code?: string;
|
|
51
|
+
request?: any;
|
|
52
|
+
response?: FetchResponse<T>;
|
|
53
|
+
isFetchError: boolean;
|
|
54
|
+
toJSON: () => object;
|
|
55
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from './client-config';
|
|
19
|
+
export * from './data';
|
|
20
|
+
export * from './custom-grant';
|
|
21
|
+
export * from './authorization-url';
|
|
22
|
+
export * from './user';
|
|
23
|
+
export * from './fetch';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Interface containing the basic user information.
|
|
20
|
+
*/
|
|
21
|
+
export interface BasicUserInfo {
|
|
22
|
+
/**
|
|
23
|
+
* The email address of the user.
|
|
24
|
+
*/
|
|
25
|
+
email?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The username of the user.
|
|
28
|
+
*/
|
|
29
|
+
username?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The display name of the user. It is the preferred_username in the id token payload or the `sub`.
|
|
32
|
+
*/
|
|
33
|
+
displayName?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The scopes allowed for the user.
|
|
36
|
+
*/
|
|
37
|
+
allowedScopes: string;
|
|
38
|
+
/**
|
|
39
|
+
* The tenant domain to which the user belongs.
|
|
40
|
+
*/
|
|
41
|
+
tenantDomain?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The session state.
|
|
44
|
+
*/
|
|
45
|
+
sessionState: string;
|
|
46
|
+
/**
|
|
47
|
+
* The `uid` corresponding to the user who the ID token belongs to.
|
|
48
|
+
*/
|
|
49
|
+
sub?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Any other attributes retrieved from teh `id_token`.
|
|
52
|
+
*/
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Interface of the authenticated user.
|
|
57
|
+
*/
|
|
58
|
+
export interface AuthenticatedUserInfo {
|
|
59
|
+
/**
|
|
60
|
+
* Authenticated user's display name.
|
|
61
|
+
*/
|
|
62
|
+
displayName?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Authenticated user's display name.
|
|
65
|
+
* @deprecated Use `displayName` instead.
|
|
66
|
+
*/
|
|
67
|
+
display_name?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* User's email.
|
|
70
|
+
*/
|
|
71
|
+
email?: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Available scopes.
|
|
74
|
+
*/
|
|
75
|
+
scope?: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Authenticated user's tenant domain.
|
|
78
|
+
*/
|
|
79
|
+
tenantDomain?: string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Authenticated user's username.
|
|
82
|
+
*/
|
|
83
|
+
username: string;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { User } from '../../models/user';
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the user information from the specified OIDC userinfo endpoint.
|
|
21
|
+
*
|
|
22
|
+
* @param requestConfig - Request configuration object.
|
|
23
|
+
* @returns A promise that resolves with the user information.
|
|
24
|
+
* @throw
|
|
25
|
+
* const userInfo = await getUserInfo({
|
|
26
|
+
* url: "https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/userinfo",
|
|
27
|
+
* });
|
|
28
|
+
* console.log(userInfo);
|
|
29
|
+
* } catch (error) {
|
|
30
|
+
* if (error instanceof AsgardeoAPIError) {
|
|
31
|
+
* console.error('Failed to get user info:', error.message);
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const getUserInfo: ({ url, ...requestConfig }: Partial<Request>) => Promise<User>;
|
|
37
|
+
export default getUserInfo;
|