@asgardeo/javascript 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/AsgardeoJavaScriptClient.d.ts +2 -1
- package/dist/IsomorphicCrypto.d.ts +4 -4
- package/dist/{__legacy__/data/data-layer.d.ts → StorageManager.d.ts} +26 -25
- package/dist/__legacy__/client.d.ts +82 -98
- package/dist/__legacy__/helpers/authentication-helper.d.ts +8 -8
- package/dist/__legacy__/models/client-config.d.ts +6 -6
- package/dist/__legacy__/models/index.d.ts +0 -5
- package/dist/api/{oidc/getUserInfo.d.ts → getUserInfo.d.ts} +1 -1
- package/dist/api/handleApplicationNativeAuthentication.d.ts +33 -0
- package/dist/api/initializeApplicationNativeAuthentication.d.ts +117 -0
- package/dist/cjs/index.js +1581 -1188
- package/dist/cjs/index.js.map +4 -4
- package/dist/constants/ApplicationNativeAuthenticationConstants.d.ts +39 -0
- package/dist/constants/OIDCRequestConstants.d.ts +14 -0
- package/dist/constants/PKCEConstants.d.ts +1 -0
- package/dist/constants/TokenExchangeConstants.d.ts +1 -1
- package/dist/{__legacy__/exception → errors}/exception.d.ts +3 -0
- package/dist/{__legacy__/data/index.d.ts → i18n/en-US.d.ts} +4 -2
- package/dist/{__legacy__/exception → i18n}/index.d.ts +2 -2
- package/dist/index.d.ts +28 -10
- package/dist/index.js +1562 -1184
- package/dist/index.js.map +4 -4
- package/dist/models/application-native-authentication.d.ts +82 -0
- package/dist/models/client.d.ts +8 -2
- package/dist/models/config.d.ts +26 -1
- package/dist/models/crypto.d.ts +2 -2
- package/dist/{__legacy__/models/custom-grant.d.ts → models/field.d.ts} +13 -9
- package/dist/models/i18n.d.ts +66 -0
- package/dist/{__legacy__/models/authorization-url.d.ts → models/oauth-request.d.ts} +3 -3
- package/dist/models/oauth-response.d.ts +1 -17
- package/dist/models/scim2-schema.d.ts +3 -0
- package/dist/{__legacy__/models/data.d.ts → models/session.d.ts} +4 -0
- package/dist/models/store.d.ts +1 -1
- package/dist/models/token.d.ts +47 -0
- package/dist/models/user.d.ts +11 -84
- package/dist/theme/types.d.ts +0 -1
- package/dist/utils/deepMerge.d.ts +44 -0
- package/dist/utils/extractTenantDomainFromIdTokenPayload.d.ts +1 -1
- package/dist/utils/extractUserClaimsFromIdToken.d.ts +1 -1
- package/dist/utils/flattenUserSchema.d.ts +64 -0
- package/dist/utils/generateFlattenedUserProfile.d.ts +46 -0
- package/dist/utils/generateUserProfile.d.ts +55 -0
- package/dist/utils/get.d.ts +29 -0
- package/dist/utils/getAuthorizeRequestUrlParams.d.ts +59 -0
- package/dist/utils/getI18nBundles.d.ts +26 -0
- package/dist/utils/getLatestStateParam.d.ts +40 -0
- package/dist/utils/processOpenIDScopes.d.ts +36 -0
- package/dist/{__legacy__/core/index.d.ts → utils/resolveFieldName.d.ts} +3 -2
- package/dist/utils/resolveFieldType.d.ts +20 -0
- package/dist/utils/set.d.ts +30 -0
- package/package.json +4 -4
- package/dist/__legacy__/core/authentication-core.d.ts +0 -51
- package/dist/__legacy__/models/fetch.d.ts +0 -55
- package/dist/__legacy__/models/user.d.ts +0 -85
- package/dist/models/id-token.d.ts +0 -55
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface ApplicationNativeAuthenticationInitiateResponse {
|
|
2
|
+
flowId: string;
|
|
3
|
+
flowStatus: ApplicationNativeAuthenticationFlowStatus;
|
|
4
|
+
flowType: ApplicationNativeAuthenticationFlowType;
|
|
5
|
+
nextStep: {
|
|
6
|
+
stepType: ApplicationNativeAuthenticationStepType;
|
|
7
|
+
authenticators: ApplicationNativeAuthenticationAuthenticator[];
|
|
8
|
+
};
|
|
9
|
+
links: ApplicationNativeAuthenticationLink[];
|
|
10
|
+
}
|
|
11
|
+
export declare enum ApplicationNativeAuthenticationFlowStatus {
|
|
12
|
+
SuccessCompleted = "SUCCESS_COMPLETED",
|
|
13
|
+
FailCompleted = "FAIL_COMPLETED",
|
|
14
|
+
FailIncomplete = "FAIL_INCOMPLETE",
|
|
15
|
+
Incomplete = "INCOMPLETE"
|
|
16
|
+
}
|
|
17
|
+
export declare enum ApplicationNativeAuthenticationFlowType {
|
|
18
|
+
Authentication = "AUTHENTICATION"
|
|
19
|
+
}
|
|
20
|
+
export declare enum ApplicationNativeAuthenticationStepType {
|
|
21
|
+
AuthenticatorPrompt = "AUTHENTICATOR_PROMPT",
|
|
22
|
+
MultOptionsPrompt = "MULTI_OPTIONS_PROMPT"
|
|
23
|
+
}
|
|
24
|
+
export interface ApplicationNativeAuthenticationAuthenticator {
|
|
25
|
+
authenticatorId: string;
|
|
26
|
+
authenticator: string;
|
|
27
|
+
idp: string;
|
|
28
|
+
metadata: {
|
|
29
|
+
i18nKey: string;
|
|
30
|
+
promptType: ApplicationNativeAuthenticationAuthenticatorPromptType;
|
|
31
|
+
params: {
|
|
32
|
+
param: string;
|
|
33
|
+
type: ApplicationNativeAuthenticationAuthenticatorParamType;
|
|
34
|
+
order: number;
|
|
35
|
+
i18nKey: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
confidential: boolean;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
requiredParams: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface ApplicationNativeAuthenticationLink {
|
|
43
|
+
name: string;
|
|
44
|
+
href: string;
|
|
45
|
+
method: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ApplicationNativeAuthenticationHandleRequestPayload {
|
|
48
|
+
flowId: string;
|
|
49
|
+
selectedAuthenticator: {
|
|
50
|
+
authenticatorId: string;
|
|
51
|
+
params: Record<string, string>;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ApplicationNativeAuthenticationHandleResponse {
|
|
55
|
+
flowStatus: string;
|
|
56
|
+
authData: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
export declare enum ApplicationNativeAuthenticationAuthenticatorParamType {
|
|
59
|
+
String = "STRING",
|
|
60
|
+
Integer = "INTEGER",
|
|
61
|
+
MultiValued = "MULTI_VALUED"
|
|
62
|
+
}
|
|
63
|
+
export declare enum ApplicationNativeAuthenticationAuthenticatorExtendedParamType {
|
|
64
|
+
Otp = "OTPCode"
|
|
65
|
+
}
|
|
66
|
+
export declare enum ApplicationNativeAuthenticationAuthenticatorKnownIdPType {
|
|
67
|
+
Local = "LOCAL"
|
|
68
|
+
}
|
|
69
|
+
export declare enum ApplicationNativeAuthenticationAuthenticatorPromptType {
|
|
70
|
+
/**
|
|
71
|
+
* Prompt for user input, typically for username/password or similar credentials.
|
|
72
|
+
*/
|
|
73
|
+
UserPrompt = "USER_PROMPT",
|
|
74
|
+
/**
|
|
75
|
+
* Prompt for internal system use, such as API keys or tokens.
|
|
76
|
+
*/
|
|
77
|
+
InternalPrompt = "INTERNAL_PROMPT",
|
|
78
|
+
/**
|
|
79
|
+
* Prompt for redirection to another page or service.
|
|
80
|
+
*/
|
|
81
|
+
RedirectionPrompt = "REDIRECTION_PROMPT"
|
|
82
|
+
}
|
package/dist/models/client.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User } from './user';
|
|
18
|
+
import { User, UserProfile } from './user';
|
|
19
19
|
export type SignInOptions = Record<string, unknown>;
|
|
20
20
|
export type SignOutOptions = Record<string, unknown>;
|
|
21
21
|
/**
|
|
@@ -35,6 +35,12 @@ export interface AsgardeoClient<T> {
|
|
|
35
35
|
* @returns User object containing user details.
|
|
36
36
|
*/
|
|
37
37
|
getUser(): Promise<User>;
|
|
38
|
+
/**
|
|
39
|
+
* Fetches the user profile along with its schemas and a flattened version of the profile.
|
|
40
|
+
*
|
|
41
|
+
* @returns A promise resolving to a UserProfile object containing the user's profile information.
|
|
42
|
+
*/
|
|
43
|
+
getUserProfile(): Promise<UserProfile>;
|
|
38
44
|
/**
|
|
39
45
|
* Initializes the authentication client with provided configuration.
|
|
40
46
|
*
|
|
@@ -51,7 +57,7 @@ export interface AsgardeoClient<T> {
|
|
|
51
57
|
isLoading(): boolean;
|
|
52
58
|
/**
|
|
53
59
|
* Checks if a user is signed in.
|
|
54
|
-
* FIXME: This should be integrated with the existing
|
|
60
|
+
* FIXME: This should be integrated with the existing isSignedIn method which returns a Promise.
|
|
55
61
|
*
|
|
56
62
|
* @returns Boolean indicating sign-in status.
|
|
57
63
|
*/
|
package/dist/models/config.d.ts
CHANGED
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { ThemeConfig, ThemeMode } from '../theme/types';
|
|
19
|
+
import { I18nBundle } from './i18n';
|
|
19
20
|
import { RecursivePartial } from './utility-types';
|
|
20
|
-
export interface BaseConfig<T = unknown> {
|
|
21
|
+
export interface BaseConfig<T = unknown> extends WithPreferences {
|
|
21
22
|
/**
|
|
22
23
|
* Optional URL where the authorization server should redirect after authentication.
|
|
23
24
|
* This must match one of the allowed redirect URIs configured in your IdP.
|
|
@@ -57,6 +58,8 @@ export interface BaseConfig<T = unknown> {
|
|
|
57
58
|
* scopes: ["openid", "profile", "email"]
|
|
58
59
|
*/
|
|
59
60
|
scopes?: string | string[] | undefined;
|
|
61
|
+
}
|
|
62
|
+
export interface WithPreferences {
|
|
60
63
|
/**
|
|
61
64
|
* Preferences for customizing the Asgardeo UI components
|
|
62
65
|
*/
|
|
@@ -73,9 +76,31 @@ export interface ThemePreferences {
|
|
|
73
76
|
*/
|
|
74
77
|
overrides?: RecursivePartial<ThemeConfig>;
|
|
75
78
|
}
|
|
79
|
+
export interface I18nPreferences {
|
|
80
|
+
/**
|
|
81
|
+
* The language to use for translations.
|
|
82
|
+
* Defaults to the browser's default language.
|
|
83
|
+
*/
|
|
84
|
+
language?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The fallback language to use if translations are not available in the specified language.
|
|
87
|
+
* Defaults to 'en-US'.
|
|
88
|
+
*/
|
|
89
|
+
fallbackLanguage?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Custom translations to override default ones.
|
|
92
|
+
*/
|
|
93
|
+
bundles?: {
|
|
94
|
+
[key: string]: I18nBundle;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
76
97
|
export interface Preferences {
|
|
77
98
|
/**
|
|
78
99
|
* Theme preferences for the Asgardeo UI components
|
|
79
100
|
*/
|
|
80
101
|
theme?: ThemePreferences;
|
|
102
|
+
/**
|
|
103
|
+
* Internationalization preferences for the Asgardeo UI components
|
|
104
|
+
*/
|
|
105
|
+
i18n?: I18nPreferences;
|
|
81
106
|
}
|
package/dist/models/crypto.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export interface Crypto<T = any> {
|
|
|
87
87
|
* @param idToken - ID Token to be verified.
|
|
88
88
|
* @param jwk - JWK to be used for verification.
|
|
89
89
|
* @param algorithms - Algorithms to be used for verification.
|
|
90
|
-
* @param
|
|
90
|
+
* @param clientId - Client ID to be used for verification.
|
|
91
91
|
* @param issuer - Issuer to be used for verification.
|
|
92
92
|
* @param subject - Subject to be used for verification.
|
|
93
93
|
* @param clockTolerance - Clock tolerance to be used for verification.
|
|
@@ -96,5 +96,5 @@ export interface Crypto<T = any> {
|
|
|
96
96
|
*
|
|
97
97
|
* @throws if the id_token is invalid.
|
|
98
98
|
*/
|
|
99
|
-
verifyJwt(idToken: string, jwk: JWKInterface, algorithms: string[],
|
|
99
|
+
verifyJwt(idToken: string, jwk: JWKInterface, algorithms: string[], clientId: string, issuer: string, subject: string, clockTolerance?: number, validateJwtIssuer?: boolean): Promise<boolean>;
|
|
100
100
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
3
|
*
|
|
4
4
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -15,12 +15,16 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
export declare enum FieldType {
|
|
19
|
+
Text = "TEXT",
|
|
20
|
+
Password = "PASSWORD",
|
|
21
|
+
Email = "EMAIL",
|
|
22
|
+
Number = "NUMBER",
|
|
23
|
+
Select = "SELECT",
|
|
24
|
+
Checkbox = "CHECKBOX",
|
|
25
|
+
Radio = "RADIO",
|
|
26
|
+
Otp = "OTP",
|
|
27
|
+
Date = "DATE",
|
|
28
|
+
Time = "TIME",
|
|
29
|
+
Textarea = "TEXTAREA"
|
|
26
30
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
export interface I18nTranslations {
|
|
19
|
+
'elements.buttons.signIn': string;
|
|
20
|
+
'elements.buttons.signOut': string;
|
|
21
|
+
'elements.buttons.signUp': string;
|
|
22
|
+
'elements.buttons.facebook': string;
|
|
23
|
+
'elements.buttons.google': string;
|
|
24
|
+
'elements.buttons.github': string;
|
|
25
|
+
'elements.buttons.microsoft': string;
|
|
26
|
+
'elements.buttons.linkedin': string;
|
|
27
|
+
'elements.buttons.ethereum': string;
|
|
28
|
+
'elements.buttons.multi.option': string;
|
|
29
|
+
'elements.buttons.social': string;
|
|
30
|
+
'elements.fields.placeholder': string;
|
|
31
|
+
'signin.title': string;
|
|
32
|
+
'email.otp.title': string;
|
|
33
|
+
'email.otp.subtitle': string;
|
|
34
|
+
'email.otp.submit.button': string;
|
|
35
|
+
'identifier.first.title': string;
|
|
36
|
+
'identifier.first.subtitle': string;
|
|
37
|
+
'identifier.first.submit.button': string;
|
|
38
|
+
'sms.otp.title': string;
|
|
39
|
+
'sms.otp.subtitle': string;
|
|
40
|
+
'sms.otp.submit.button': string;
|
|
41
|
+
'totp.title': string;
|
|
42
|
+
'totp.subtitle': string;
|
|
43
|
+
'totp.submit.button': string;
|
|
44
|
+
'username.password.submit.button': string;
|
|
45
|
+
'username.password.title': string;
|
|
46
|
+
'username.password.subtitle': string;
|
|
47
|
+
'messages.loading': string;
|
|
48
|
+
'errors.title': string;
|
|
49
|
+
'errors.sign.in.initialization': string;
|
|
50
|
+
'errors.sign.in.flow.failure': string;
|
|
51
|
+
'errors.sign.in.flow.completion.failure': string;
|
|
52
|
+
'errors.sign.in.flow.passkeys.failure': string;
|
|
53
|
+
'errors.sign.in.flow.passkeys.completion.failure': string;
|
|
54
|
+
}
|
|
55
|
+
export type I18nTextDirection = 'ltr' | 'rtl';
|
|
56
|
+
export interface I18nMetadata {
|
|
57
|
+
localeCode: string;
|
|
58
|
+
countryCode: string;
|
|
59
|
+
languageCode: string;
|
|
60
|
+
displayName: string;
|
|
61
|
+
direction: I18nTextDirection;
|
|
62
|
+
}
|
|
63
|
+
export interface I18nBundle {
|
|
64
|
+
metadata: I18nMetadata;
|
|
65
|
+
translations: I18nTranslations;
|
|
66
|
+
}
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
19
|
-
export interface
|
|
18
|
+
export type AuthorizeRequestUrlParams = Omit<ExtendedAuthorizeRequestUrlParams, 'forceInit'>;
|
|
19
|
+
export interface KnownExtendedAuthorizeRequestUrlParams {
|
|
20
20
|
fidp?: string;
|
|
21
21
|
forceInit?: boolean;
|
|
22
22
|
}
|
|
23
|
-
export type
|
|
23
|
+
export type ExtendedAuthorizeRequestUrlParams = KnownExtendedAuthorizeRequestUrlParams & Record<string, string | boolean>;
|
|
@@ -15,20 +15,4 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
* Enum representing different OAuth response modes.
|
|
20
|
-
*/
|
|
21
|
-
export declare enum ResponseMode {
|
|
22
|
-
/**
|
|
23
|
-
* Response is returned as POST parameters in an HTML form.
|
|
24
|
-
*/
|
|
25
|
-
FormPost = "form_post",
|
|
26
|
-
/**
|
|
27
|
-
* Response is returned as query parameters in the URL.
|
|
28
|
-
*/
|
|
29
|
-
Query = "query",
|
|
30
|
-
/**
|
|
31
|
-
* Response is returned directly to the client.
|
|
32
|
-
*/
|
|
33
|
-
Direct = "direct"
|
|
34
|
-
}
|
|
18
|
+
export type OAuthResponseMode = 'form_post' | 'query' | 'direct';
|
package/dist/models/store.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { OIDCEndpoints } from './oidc-endpoints';
|
|
|
21
21
|
* Implementations can include various storage backends like browser storage,
|
|
22
22
|
* memory cache, or distributed caches like Redis or Memcached.
|
|
23
23
|
*/
|
|
24
|
-
export interface
|
|
24
|
+
export interface Storage {
|
|
25
25
|
/**
|
|
26
26
|
* Stores a value with the specified key.
|
|
27
27
|
*
|
package/dist/models/token.d.ts
CHANGED
|
@@ -119,3 +119,50 @@ export interface AccessTokenApiResponse {
|
|
|
119
119
|
*/
|
|
120
120
|
token_type: string;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Interface for the standard (required) claims of an ID Token payload.
|
|
124
|
+
*/
|
|
125
|
+
export interface IdTokenPayloadStandardClaims {
|
|
126
|
+
/**
|
|
127
|
+
* The audience for which this token is intended.
|
|
128
|
+
*/
|
|
129
|
+
aud: string | string[];
|
|
130
|
+
/**
|
|
131
|
+
* The unique identifier of the user to whom the ID token belongs.
|
|
132
|
+
*/
|
|
133
|
+
sub: string;
|
|
134
|
+
/**
|
|
135
|
+
* The issuer identifier for the issuer of the response.
|
|
136
|
+
*/
|
|
137
|
+
iss: string;
|
|
138
|
+
/**
|
|
139
|
+
* The email of the user.
|
|
140
|
+
*/
|
|
141
|
+
email?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The username the user prefers to be called.
|
|
144
|
+
*/
|
|
145
|
+
preferred_username?: string;
|
|
146
|
+
/**
|
|
147
|
+
* The tenant domain of the user.
|
|
148
|
+
*/
|
|
149
|
+
tenant_domain?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Interface for ID Token payload including custom claims.
|
|
153
|
+
*/
|
|
154
|
+
export interface IdTokenPayload extends IdTokenPayloadStandardClaims {
|
|
155
|
+
/**
|
|
156
|
+
* Other custom claims.
|
|
157
|
+
*/
|
|
158
|
+
[claim: string]: any;
|
|
159
|
+
}
|
|
160
|
+
export interface TokenExchangeRequestConfig {
|
|
161
|
+
id: string;
|
|
162
|
+
data: any;
|
|
163
|
+
signInRequired: boolean;
|
|
164
|
+
attachToken: boolean;
|
|
165
|
+
returnsSession: boolean;
|
|
166
|
+
tokenEndpoint?: string;
|
|
167
|
+
shouldReplayAfterRefresh?: boolean;
|
|
168
|
+
}
|
package/dist/models/user.d.ts
CHANGED
|
@@ -16,91 +16,18 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { Schema } from './scim2-schema';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
lastModified: string;
|
|
26
|
-
resourceType: string;
|
|
19
|
+
export interface KnownUser {
|
|
20
|
+
username?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
givenName?: string;
|
|
23
|
+
familyName?: string;
|
|
24
|
+
displayName?: string;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
export interface UserRole {
|
|
32
|
-
audienceValue: string;
|
|
33
|
-
display: string;
|
|
34
|
-
audienceType: string;
|
|
35
|
-
value: string;
|
|
36
|
-
$ref: string;
|
|
37
|
-
audienceDisplay: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Type for the Name object in SCIM2 responses
|
|
41
|
-
*/
|
|
42
|
-
export interface UserName {
|
|
43
|
-
formatted: string;
|
|
44
|
-
givenName: string;
|
|
45
|
-
familyName: string;
|
|
26
|
+
export interface User extends KnownUser {
|
|
27
|
+
[key: string]: any;
|
|
46
28
|
}
|
|
47
|
-
|
|
48
|
-
* Represents a user in the Asgardeo system.
|
|
49
|
-
*
|
|
50
|
-
* @remarks
|
|
51
|
-
* This interface defines the user properties based on the SCIM2 schema.
|
|
52
|
-
* WSO2 specific properties are flattened to the root level for easier access.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const user: User = {
|
|
57
|
-
* emails: ["user@example.com"],
|
|
58
|
-
* profileUrl: "https://gravatar.com/avatar/123",
|
|
59
|
-
* meta: {
|
|
60
|
-
* created: "2021-06-21T11:28:21.800618Z",
|
|
61
|
-
* location: "https://api.asgardeo.io/scim2/Users/123",
|
|
62
|
-
* lastModified: "2025-04-30T06:46:48.520896Z",
|
|
63
|
-
* resourceType: "User"
|
|
64
|
-
* },
|
|
65
|
-
* name: {
|
|
66
|
-
* formatted: "John Smith",
|
|
67
|
-
* givenName: "John",
|
|
68
|
-
* familyName: "Smith"
|
|
69
|
-
* },
|
|
70
|
-
* userName: "john@example.com",
|
|
71
|
-
* id: "123",
|
|
72
|
-
* // Flattened WSO2 schema properties
|
|
73
|
-
* accountState: "UNLOCKED",
|
|
74
|
-
* accountLocked: "false",
|
|
75
|
-
* photoUrl: "https://gravatar.com/avatar/123",
|
|
76
|
-
* emailVerified: "true",
|
|
77
|
-
* lastLogonTime: "1749098996152"
|
|
78
|
-
* };
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export interface User {
|
|
82
|
-
emails: string[];
|
|
83
|
-
profileUrl?: string;
|
|
84
|
-
meta: UserMeta;
|
|
29
|
+
export interface UserProfile {
|
|
85
30
|
schemas: Schema[];
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
id: string;
|
|
89
|
-
userName: string;
|
|
90
|
-
accountState?: string;
|
|
91
|
-
accountLocked?: string;
|
|
92
|
-
failedLoginLockoutCount?: string;
|
|
93
|
-
failedTOTPAttempts?: string;
|
|
94
|
-
failedLoginAttempts?: string;
|
|
95
|
-
totpEnabled?: string;
|
|
96
|
-
photoUrl?: string;
|
|
97
|
-
emailVerified?: string;
|
|
98
|
-
backupCodeEnabled?: string;
|
|
99
|
-
lastLogonTime?: string;
|
|
100
|
-
signedUpRegion?: string;
|
|
101
|
-
unlockTime?: string;
|
|
102
|
-
isReadOnlyUser?: string;
|
|
103
|
-
failedLoginAttemptsBeforeSuccess?: string;
|
|
104
|
-
[key: string]: any;
|
|
31
|
+
profile: User;
|
|
32
|
+
flattenedProfile: User;
|
|
105
33
|
}
|
|
106
|
-
export default User;
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Recursively merges the properties of source objects into a target object.
|
|
20
|
+
* Similar to Lodash's merge function, this creates a deep copy and merges
|
|
21
|
+
* nested objects recursively. Arrays and non-plain objects are replaced entirely.
|
|
22
|
+
*
|
|
23
|
+
* @param target - The target object to merge into
|
|
24
|
+
* @param sources - One or more source objects to merge from
|
|
25
|
+
* @returns A new object with merged properties
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const obj1 = { a: 1, b: { x: 1, y: 2 } };
|
|
30
|
+
* const obj2 = { b: { y: 3, z: 4 }, c: 3 };
|
|
31
|
+
* const result = deepMerge(obj1, obj2);
|
|
32
|
+
* // Result: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 3 }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const config = { theme: { colors: { primary: 'blue' } } };
|
|
38
|
+
* const userPrefs = { theme: { colors: { secondary: 'red' } } };
|
|
39
|
+
* const merged = deepMerge(config, userPrefs);
|
|
40
|
+
* // Result: { theme: { colors: { primary: 'blue', secondary: 'red' } } }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const deepMerge: <T extends Record<string, any>>(target: T, ...sources: Array<Record<string, any> | undefined | null>) => T;
|
|
44
|
+
export default deepMerge;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { IdTokenPayload } from '../models/
|
|
18
|
+
import { IdTokenPayload } from '../models/token';
|
|
19
19
|
/**
|
|
20
20
|
* Extracts the tenant domain from the ID token payload.
|
|
21
21
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { IdTokenPayload } from '../models/
|
|
18
|
+
import { IdTokenPayload } from '../models/token';
|
|
19
19
|
/**
|
|
20
20
|
* Removes standard protocol-specific claims from the ID token payload
|
|
21
21
|
* and returns a camelCased object of user-specific claims.
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { Schema, FlattenedSchema } from '../models/scim2-schema';
|
|
19
|
+
/**
|
|
20
|
+
* Flattens nested schema attributes into a flat structure for easier processing
|
|
21
|
+
*
|
|
22
|
+
* This function processes SCIM2 schemas and creates a flattened representation by:
|
|
23
|
+
* - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')
|
|
24
|
+
* - Adding schema ID reference to each flattened attribute
|
|
25
|
+
* - Preserving all original attribute properties while adding schema context
|
|
26
|
+
* - Only including leaf-level attributes (sub-attributes) and top-level simple attributes
|
|
27
|
+
*
|
|
28
|
+
* @param schemas - Array of SCIM2 schemas containing nested attribute structures
|
|
29
|
+
* @returns Array of flattened schema attributes with dot-notation names and schema references
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const schemas = [
|
|
34
|
+
* {
|
|
35
|
+
* id: 'urn:ietf:params:scim:schemas:core:2.0:User',
|
|
36
|
+
* attributes: [
|
|
37
|
+
* {
|
|
38
|
+
* name: 'userName',
|
|
39
|
+
* type: 'string',
|
|
40
|
+
* multiValued: false
|
|
41
|
+
* },
|
|
42
|
+
* {
|
|
43
|
+
* name: 'name',
|
|
44
|
+
* type: 'complex',
|
|
45
|
+
* multiValued: false,
|
|
46
|
+
* subAttributes: [
|
|
47
|
+
* { name: 'givenName', type: 'string', multiValued: false },
|
|
48
|
+
* { name: 'familyName', type: 'string', multiValued: false }
|
|
49
|
+
* ]
|
|
50
|
+
* }
|
|
51
|
+
* ]
|
|
52
|
+
* }
|
|
53
|
+
* ];
|
|
54
|
+
*
|
|
55
|
+
* const flattened = flattenUserSchema(schemas);
|
|
56
|
+
* // Result: [
|
|
57
|
+
* // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
|
|
58
|
+
* // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },
|
|
59
|
+
* // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }
|
|
60
|
+
* // ]
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const flattenUserSchema: (schemas: Schema[]) => FlattenedSchema[];
|
|
64
|
+
export default flattenUserSchema;
|