@masterteam/gateway-auth 0.0.16 → 0.0.17
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterteam/gateway-auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/gateway-auth",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@ngxs/store": "^20.1.0",
|
|
16
16
|
"rxjs": "^7.8.2",
|
|
17
17
|
"@masterteam/brand-display": "^0.0.11",
|
|
18
|
-
"@masterteam/components": "^0.0.
|
|
18
|
+
"@masterteam/components": "^0.0.169",
|
|
19
19
|
"@masterteam/icons": "^0.0.15"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
@@ -80,6 +80,7 @@ interface GatewayLoginResponse {
|
|
|
80
80
|
interface GatewayLoginRequest {
|
|
81
81
|
userName: string;
|
|
82
82
|
password: string;
|
|
83
|
+
applicationCode?: string;
|
|
83
84
|
isEncrypted?: boolean;
|
|
84
85
|
deviceToken?: string;
|
|
85
86
|
recaptchaToken?: string;
|
|
@@ -133,6 +134,7 @@ interface GatewayExternalTokenExchangeRequest {
|
|
|
133
134
|
subjectToken: string;
|
|
134
135
|
subjectTokenType: 'urn:ietf:params:oauth:token-type:access_token';
|
|
135
136
|
deviceToken?: string;
|
|
137
|
+
applicationCode?: string;
|
|
136
138
|
}
|
|
137
139
|
interface GatewayNafathStartRequest {
|
|
138
140
|
nationalId: string;
|
|
@@ -183,6 +185,32 @@ interface GatewayMappedUser {
|
|
|
183
185
|
tempSessionId?: string;
|
|
184
186
|
id?: string;
|
|
185
187
|
}
|
|
188
|
+
interface GatewayApplicationListItem {
|
|
189
|
+
applicationCode: string;
|
|
190
|
+
applicationName?: string;
|
|
191
|
+
launchUrl?: string;
|
|
192
|
+
}
|
|
193
|
+
interface GatewayApplicationsData {
|
|
194
|
+
applications: GatewayApplicationListItem[];
|
|
195
|
+
}
|
|
196
|
+
interface GatewayApplicationLaunchData {
|
|
197
|
+
applicationCode: string;
|
|
198
|
+
applicationName?: string;
|
|
199
|
+
launchUrl?: string;
|
|
200
|
+
tokens: GatewayAuthTokens;
|
|
201
|
+
}
|
|
202
|
+
interface GatewayApplicationContextData {
|
|
203
|
+
applicationCode: string;
|
|
204
|
+
}
|
|
205
|
+
interface GatewayAppSession {
|
|
206
|
+
applicationCode: string;
|
|
207
|
+
applicationName?: string;
|
|
208
|
+
launchUrl?: string;
|
|
209
|
+
accessToken: string;
|
|
210
|
+
refreshToken: string;
|
|
211
|
+
accessTokenExpiresAt: string | null;
|
|
212
|
+
refreshTokenExpiresAt: string | null;
|
|
213
|
+
}
|
|
186
214
|
|
|
187
215
|
declare const GATEWAY_AUTH_DEVICE_TOKEN = "web-app";
|
|
188
216
|
declare const GATEWAY_AUTH_DEVICE_TOKEN_STORAGE_KEY = "masterteam.gateway-auth.device-token";
|
|
@@ -195,9 +223,12 @@ declare const GATEWAY_AUTH_ENDPOINTS: {
|
|
|
195
223
|
readonly resendMfa: "auth/2fa/resend";
|
|
196
224
|
readonly refresh: "auth/refresh";
|
|
197
225
|
readonly logout: "auth/logout";
|
|
226
|
+
readonly meApplications: "auth/me/applications";
|
|
227
|
+
readonly applicationContext: "public/application-context";
|
|
198
228
|
readonly ssoProviders: "auth/sso/providers";
|
|
199
229
|
readonly ssoExchange: "auth/sso/exchange";
|
|
200
230
|
readonly ssoTokenExchange: "auth/sso/token-exchange";
|
|
231
|
+
readonly applicationLaunch: (applicationCode: string) => string;
|
|
201
232
|
readonly nafathStart: (providerKey: string) => string;
|
|
202
233
|
readonly nafathStatus: (providerKey: string) => string;
|
|
203
234
|
readonly ssoStart: (providerKey: string) => string;
|
|
@@ -206,6 +237,7 @@ declare function isExpired(expireAt?: string | null, skewMs?: number): boolean;
|
|
|
206
237
|
declare function resolveApiDateValue(value?: GatewayApiDateValue | null): string | null;
|
|
207
238
|
declare function mapGatewayTokens(tokens: GatewayAuthTokens | GatewayRefreshData): GatewayMappedTokens;
|
|
208
239
|
declare function resolveAccessTokenRefreshSkewMs(skewMs?: number | null): number;
|
|
240
|
+
declare function resolveApplicationCodeOption(applicationCode?: string | (() => string | null | undefined) | null): string | null;
|
|
209
241
|
declare function resolveGatewayDeviceToken(deviceToken?: GatewayDeviceTokenOption | null): string;
|
|
210
242
|
declare function withGatewayAuthNgswBypass(url: string): string;
|
|
211
243
|
declare function readPersistedGatewayAuthTokens(): GatewayAuthTokens | null;
|
|
@@ -256,6 +288,8 @@ type AuthRefreshData = GatewayRefreshData;
|
|
|
256
288
|
type TwoFactorChallenge = GatewayTwoFactorChallenge;
|
|
257
289
|
type SsoProvider = GatewaySsoProvider;
|
|
258
290
|
type Response<T> = GatewayResponse<T>;
|
|
291
|
+
type ApplicationListItem = GatewayApplicationListItem;
|
|
292
|
+
type AppSession = GatewayAppSession;
|
|
259
293
|
type AuthRateLimitScope = 'login' | 'verifyMfa' | 'resendMfa' | 'ssoExchange';
|
|
260
294
|
interface AuthRateLimit {
|
|
261
295
|
retryUntilMs: number | null;
|
|
@@ -278,6 +312,10 @@ interface AuthStateModel {
|
|
|
278
312
|
pendingMfa: TwoFactorChallenge | null;
|
|
279
313
|
ssoProviders: SsoProvider[];
|
|
280
314
|
rateLimit: AuthRateLimit | null;
|
|
315
|
+
applications: ApplicationListItem[];
|
|
316
|
+
applicationsLoading: boolean;
|
|
317
|
+
appSessions: Record<string, AppSession>;
|
|
318
|
+
appLaunchLoading: Record<string, boolean>;
|
|
281
319
|
}
|
|
282
320
|
declare const AUTH_STATE_DEFAULTS: AuthStateModel;
|
|
283
321
|
declare function sanitizePersistedAuthState(obj: Partial<AuthStateModel> | null): {
|
|
@@ -290,6 +328,10 @@ declare function sanitizePersistedAuthState(obj: Partial<AuthStateModel> | null)
|
|
|
290
328
|
pendingMfa: null;
|
|
291
329
|
ssoProviders: never[];
|
|
292
330
|
rateLimit: AuthRateLimit | null;
|
|
331
|
+
applications: GatewayApplicationListItem[];
|
|
332
|
+
applicationsLoading: boolean;
|
|
333
|
+
appSessions: Record<string, GatewayAppSession>;
|
|
334
|
+
appLaunchLoading: {};
|
|
293
335
|
user: User | null;
|
|
294
336
|
token: string | null;
|
|
295
337
|
refreshToken: string | null;
|
|
@@ -298,6 +340,7 @@ declare function sanitizePersistedAuthState(obj: Partial<AuthStateModel> | null)
|
|
|
298
340
|
};
|
|
299
341
|
|
|
300
342
|
type GatewayAuthHookResult = void | null | Observable<unknown> | Promise<unknown>;
|
|
343
|
+
type GatewayApplicationCodeOption = string | (() => string | null | undefined);
|
|
301
344
|
interface GatewayLoginLanguageOption {
|
|
302
345
|
key: string;
|
|
303
346
|
id?: string;
|
|
@@ -327,6 +370,9 @@ interface GatewayAuthOptions {
|
|
|
327
370
|
defaultAuthenticatedRoute?: string | (() => string | null | undefined);
|
|
328
371
|
preserveSsoProvidersOnLogout?: boolean;
|
|
329
372
|
loginPage?: GatewayLoginPageOptions;
|
|
373
|
+
applicationCode?: GatewayApplicationCodeOption;
|
|
374
|
+
autoLaunchApplicationOnLogin?: boolean;
|
|
375
|
+
resolveApplicationCodeForRequest?: (request: HttpRequest<unknown>) => string | null | undefined;
|
|
330
376
|
afterLogin?: (session: GatewayLoginResponse, ctx: StateContext<AuthStateModel>) => GatewayAuthHookResult;
|
|
331
377
|
beforeLocalLogout?: (ctx: StateContext<AuthStateModel>) => GatewayAuthHookResult;
|
|
332
378
|
}
|
|
@@ -398,6 +444,40 @@ declare class SetRateLimit {
|
|
|
398
444
|
declare class ClearRateLimit {
|
|
399
445
|
static readonly type = "[Auth] Clear Rate Limit";
|
|
400
446
|
}
|
|
447
|
+
declare class LoadApplications {
|
|
448
|
+
static readonly type = "[Auth] Load Applications";
|
|
449
|
+
}
|
|
450
|
+
declare class SetApplications {
|
|
451
|
+
applications: ApplicationListItem[];
|
|
452
|
+
static readonly type = "[Auth] Set Applications";
|
|
453
|
+
constructor(applications: ApplicationListItem[]);
|
|
454
|
+
}
|
|
455
|
+
declare class LaunchApplication {
|
|
456
|
+
applicationCode: string;
|
|
457
|
+
returnUrl?: string | undefined;
|
|
458
|
+
navigate: boolean;
|
|
459
|
+
static readonly type = "[Auth] Launch Application";
|
|
460
|
+
constructor(applicationCode: string, returnUrl?: string | undefined, navigate?: boolean);
|
|
461
|
+
}
|
|
462
|
+
declare class SetAppSession {
|
|
463
|
+
session: AppSession;
|
|
464
|
+
static readonly type = "[Auth] Set App Session";
|
|
465
|
+
constructor(session: AppSession);
|
|
466
|
+
}
|
|
467
|
+
declare class UpdateAppTokens {
|
|
468
|
+
applicationCode: string;
|
|
469
|
+
tokens: AuthTokens;
|
|
470
|
+
static readonly type = "[Auth] Update App Tokens";
|
|
471
|
+
constructor(applicationCode: string, tokens: AuthTokens);
|
|
472
|
+
}
|
|
473
|
+
declare class ClearAppSession {
|
|
474
|
+
applicationCode: string;
|
|
475
|
+
static readonly type = "[Auth] Clear App Session";
|
|
476
|
+
constructor(applicationCode: string);
|
|
477
|
+
}
|
|
478
|
+
declare class ClearAllAppSessions {
|
|
479
|
+
static readonly type = "[Auth] Clear All App Sessions";
|
|
480
|
+
}
|
|
401
481
|
|
|
402
482
|
declare class GatewayAuthState {
|
|
403
483
|
private readonly http;
|
|
@@ -421,6 +501,10 @@ declare class GatewayAuthState {
|
|
|
421
501
|
static rateLimit(state: AuthStateModel): AuthRateLimit | null;
|
|
422
502
|
static isAdmin(state: AuthStateModel): boolean;
|
|
423
503
|
static userDetails(state: AuthStateModel): _masterteam_gateway_auth.GatewayUserDetails | null;
|
|
504
|
+
static applications(state: AuthStateModel): ApplicationListItem[];
|
|
505
|
+
static applicationsLoading(state: AuthStateModel): boolean;
|
|
506
|
+
static appSessions(state: AuthStateModel): Record<string, AppSession>;
|
|
507
|
+
static appLaunchLoading(state: AuthStateModel): Record<string, boolean>;
|
|
424
508
|
login(ctx: StateContext<AuthStateModel>, action: Login): Observable<unknown>;
|
|
425
509
|
verifyMfa(ctx: StateContext<AuthStateModel>, action: VerifyMfa): Observable<unknown>;
|
|
426
510
|
resendMfa(ctx: StateContext<AuthStateModel>): Observable<GatewayResponse<GatewayTwoFactorChallenge> | null>;
|
|
@@ -436,9 +520,18 @@ declare class GatewayAuthState {
|
|
|
436
520
|
clearPendingMfa(ctx: StateContext<AuthStateModel>): void;
|
|
437
521
|
setRateLimit(ctx: StateContext<AuthStateModel>, action: SetRateLimit): void;
|
|
438
522
|
clearRateLimit(ctx: StateContext<AuthStateModel>): void;
|
|
523
|
+
loadApplications(ctx: StateContext<AuthStateModel>): Observable<GatewayResponse<GatewayApplicationsData> | null>;
|
|
524
|
+
setApplications(ctx: StateContext<AuthStateModel>, action: SetApplications): void;
|
|
525
|
+
launchApplication(ctx: StateContext<AuthStateModel>, action: LaunchApplication): Observable<GatewayResponse<GatewayApplicationLaunchData> | null>;
|
|
526
|
+
setAppSession(ctx: StateContext<AuthStateModel>, action: SetAppSession): void;
|
|
527
|
+
updateAppTokens(ctx: StateContext<AuthStateModel>, action: UpdateAppTokens): void;
|
|
528
|
+
clearAppSession(ctx: StateContext<AuthStateModel>, action: ClearAppSession): void;
|
|
529
|
+
clearAllAppSessions(ctx: StateContext<AuthStateModel>): void;
|
|
530
|
+
private removeLoadingFlag;
|
|
439
531
|
private isRateLimitActive;
|
|
440
532
|
private handleRateLimit;
|
|
441
533
|
private handleLoginResponse;
|
|
534
|
+
private maybeAutoLaunchApplication;
|
|
442
535
|
private get deviceToken();
|
|
443
536
|
private gatewayUrl;
|
|
444
537
|
private gatewayAuthMutationUrl;
|
|
@@ -468,6 +561,10 @@ declare class GatewayAuthFacade {
|
|
|
468
561
|
readonly rateLimit: _angular_core.Signal<_masterteam_gateway_auth.AuthRateLimit | null>;
|
|
469
562
|
readonly isAdmin: _angular_core.Signal<boolean>;
|
|
470
563
|
readonly userDetails: _angular_core.Signal<_masterteam_gateway_auth.GatewayUserDetails | null>;
|
|
564
|
+
readonly applications: _angular_core.Signal<_masterteam_gateway_auth.GatewayApplicationListItem[]>;
|
|
565
|
+
readonly applicationsLoading: _angular_core.Signal<boolean>;
|
|
566
|
+
readonly appSessions: _angular_core.Signal<Record<string, _masterteam_gateway_auth.GatewayAppSession>>;
|
|
567
|
+
readonly appLaunchLoading: _angular_core.Signal<Record<string, boolean>>;
|
|
471
568
|
readonly hasError: _angular_core.Signal<boolean>;
|
|
472
569
|
readonly isReady: _angular_core.Signal<boolean>;
|
|
473
570
|
readonly userDisplayName: _angular_core.Signal<string>;
|
|
@@ -484,6 +581,15 @@ declare class GatewayAuthFacade {
|
|
|
484
581
|
logout(remote?: boolean): void;
|
|
485
582
|
updateUserData(user: User): void;
|
|
486
583
|
updateTokens(tokens: AuthTokens): void;
|
|
584
|
+
loadApplications(): void;
|
|
585
|
+
setApplications(applications: ApplicationListItem[]): void;
|
|
586
|
+
launchApplication(applicationCode: string, returnUrl?: string, navigate?: boolean): void;
|
|
587
|
+
setAppSession(session: AppSession): void;
|
|
588
|
+
updateAppTokens(applicationCode: string, tokens: AuthTokens): void;
|
|
589
|
+
clearAppSession(applicationCode: string): void;
|
|
590
|
+
clearAllAppSessions(): void;
|
|
591
|
+
getAppSession(applicationCode: string): AppSession | null;
|
|
592
|
+
getAppToken(applicationCode: string): string | null;
|
|
487
593
|
clearError(): void;
|
|
488
594
|
clearPendingMfa(): void;
|
|
489
595
|
clearRateLimit(): void;
|
|
@@ -539,7 +645,7 @@ declare class GatewayLoginPage implements OnInit {
|
|
|
539
645
|
readonly logoUrl: _angular_core.Signal<string | null>;
|
|
540
646
|
readonly defaultLogoUrl: _angular_core.Signal<string | null>;
|
|
541
647
|
readonly backgroundImage: _angular_core.Signal<string | null>;
|
|
542
|
-
readonly formPosition: _angular_core.Signal<"
|
|
648
|
+
readonly formPosition: _angular_core.Signal<"center" | "start" | "end">;
|
|
543
649
|
readonly logoAlignment: _angular_core.Signal<string>;
|
|
544
650
|
readonly formContainerClasses: _angular_core.Signal<"flex flex-col justify-center p-8 w-full items-center" | "flex flex-col justify-center p-8 w-full md:w-1/2 items-center" | "flex flex-col justify-center p-8 w-full md:w-1/2 items-start">;
|
|
545
651
|
constructor();
|
|
@@ -606,5 +712,5 @@ declare class GatewaySsoButtons implements OnInit {
|
|
|
606
712
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<GatewaySsoButtons, "mt-gateway-sso-buttons", never, { "dividerLabel": { "alias": "dividerLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
607
713
|
}
|
|
608
714
|
|
|
609
|
-
export { AUTH_STATE_DEFAULTS, ClearError, ClearPendingMfa, ClearRateLimit, ExchangeSsoCode, GATEWAY_AUTH_ACCESS_TOKEN_REFRESH_SKEW_MS, GATEWAY_AUTH_DEVICE_TOKEN, GATEWAY_AUTH_DEVICE_TOKEN_STORAGE_KEY, GATEWAY_AUTH_ENDPOINTS, GATEWAY_AUTH_NGSW_BYPASS_PARAM, GATEWAY_AUTH_OPTIONS, GATEWAY_AUTH_RETRY_CONTEXT, GATEWAY_RATE_LIMIT_ERROR_CODE, GATEWAY_RATE_LIMIT_STATUS, GatewayAuthFacade, GatewayAuthState, GatewayLoginPage, GatewayMfa, GatewaySsoButtons, GatewaySsoCallback, GatewaySsoSession, LoadSsoProviders, Login, LoginFailure, LoginSuccess, Logout, ResendMfa, SetRateLimit, StartSso, UpdateTokens, UpdateUserData, VerifyMfa, buildGatewayUrl, buildSsoStartUrl, createSecureClientState, extractGatewayRateLimitInfo, gatewayAuthInterceptor, getGatewayErrorMessage, hasGatewayTokens, isExpired, isGatewayAuthRequestUrl, mapGatewayTokens, mapGatewayUser, normalizeGatewayBase, readPersistedGatewayAuthTokens, resolveAccessTokenRefreshSkewMs, resolveApiDateValue, resolveGatewayAuthPath, resolveGatewayDeviceToken, sanitizePersistedAuthState, withGatewayAuthNgswBypass };
|
|
610
|
-
export type { ApiDateValue, AuthLoginData, AuthRateLimit, AuthRateLimitScope, AuthRefreshData, AuthStateModel, AuthTokens, BuildSsoStartUrlOptions, GatewayApiDateValue, GatewayAuthHookResult, GatewayAuthOptions, GatewayAuthTokens, GatewayDeviceTokenOption, GatewayExternalTokenExchangeRequest, GatewayLoginLanguageOption, GatewayLoginPageOptions, GatewayLoginRequest, GatewayLoginResponse, GatewayLogoutRequest, GatewayMappedTokens, GatewayMappedUser, GatewayNafathStartData, GatewayNafathStartRequest, GatewayNafathStatusData, GatewayNafathStatusRequest, GatewayPlatform, GatewayRateLimitInfo, GatewayRefreshData, GatewayRefreshRequest, GatewayResendMfaRequest, GatewayResponse, GatewaySsoExchangeRequest, GatewaySsoFlow, GatewaySsoProtocol, GatewaySsoProvider, GatewaySsoProvidersData, GatewayTwoFactorChallenge, GatewayUserDetails, GatewayVerifyMfaRequest, LoginRequest, Response, SsoProvider, TwoFactorChallenge, User, UserDetails };
|
|
715
|
+
export { AUTH_STATE_DEFAULTS, ClearAllAppSessions, ClearAppSession, ClearError, ClearPendingMfa, ClearRateLimit, ExchangeSsoCode, GATEWAY_AUTH_ACCESS_TOKEN_REFRESH_SKEW_MS, GATEWAY_AUTH_DEVICE_TOKEN, GATEWAY_AUTH_DEVICE_TOKEN_STORAGE_KEY, GATEWAY_AUTH_ENDPOINTS, GATEWAY_AUTH_NGSW_BYPASS_PARAM, GATEWAY_AUTH_OPTIONS, GATEWAY_AUTH_RETRY_CONTEXT, GATEWAY_RATE_LIMIT_ERROR_CODE, GATEWAY_RATE_LIMIT_STATUS, GatewayAuthFacade, GatewayAuthState, GatewayLoginPage, GatewayMfa, GatewaySsoButtons, GatewaySsoCallback, GatewaySsoSession, LaunchApplication, LoadApplications, LoadSsoProviders, Login, LoginFailure, LoginSuccess, Logout, ResendMfa, SetAppSession, SetApplications, SetRateLimit, StartSso, UpdateAppTokens, UpdateTokens, UpdateUserData, VerifyMfa, buildGatewayUrl, buildSsoStartUrl, createSecureClientState, extractGatewayRateLimitInfo, gatewayAuthInterceptor, getGatewayErrorMessage, hasGatewayTokens, isExpired, isGatewayAuthRequestUrl, mapGatewayTokens, mapGatewayUser, normalizeGatewayBase, readPersistedGatewayAuthTokens, resolveAccessTokenRefreshSkewMs, resolveApiDateValue, resolveApplicationCodeOption, resolveGatewayAuthPath, resolveGatewayDeviceToken, sanitizePersistedAuthState, withGatewayAuthNgswBypass };
|
|
716
|
+
export type { ApiDateValue, AppSession, ApplicationListItem, AuthLoginData, AuthRateLimit, AuthRateLimitScope, AuthRefreshData, AuthStateModel, AuthTokens, BuildSsoStartUrlOptions, GatewayApiDateValue, GatewayAppSession, GatewayApplicationCodeOption, GatewayApplicationContextData, GatewayApplicationLaunchData, GatewayApplicationListItem, GatewayApplicationsData, GatewayAuthHookResult, GatewayAuthOptions, GatewayAuthTokens, GatewayDeviceTokenOption, GatewayExternalTokenExchangeRequest, GatewayLoginLanguageOption, GatewayLoginPageOptions, GatewayLoginRequest, GatewayLoginResponse, GatewayLogoutRequest, GatewayMappedTokens, GatewayMappedUser, GatewayNafathStartData, GatewayNafathStartRequest, GatewayNafathStatusData, GatewayNafathStatusRequest, GatewayPlatform, GatewayRateLimitInfo, GatewayRefreshData, GatewayRefreshRequest, GatewayResendMfaRequest, GatewayResponse, GatewaySsoExchangeRequest, GatewaySsoFlow, GatewaySsoProtocol, GatewaySsoProvider, GatewaySsoProvidersData, GatewayTwoFactorChallenge, GatewayUserDetails, GatewayVerifyMfaRequest, LoginRequest, Response, SsoProvider, TwoFactorChallenge, User, UserDetails };
|