@osovitny/anatoly 3.16.35 → 3.16.37
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/esm2022/lib/iam/b2c/b2c.mjs +5 -8
- package/esm2022/lib/iam/b2c/consts.mjs +3 -3
- package/esm2022/lib/iam/configs.mjs +2 -2
- package/esm2022/lib/iam/services/auth.service.mjs +114 -25
- package/esm2022/lib/iam/storage.mjs +4 -1
- package/esm2022/lib/iam/utils.mjs +11 -3
- package/fesm2022/osovitny-anatoly.mjs +246 -151
- package/fesm2022/osovitny-anatoly.mjs.map +1 -1
- package/lib/iam/b2c/b2c.d.ts +0 -1
- package/lib/iam/b2c/consts.d.ts +1 -1
- package/lib/iam/iam-pages.routes.d.ts +1 -1
- package/lib/iam/services/auth.service.d.ts +4 -2
- package/lib/iam/storage.d.ts +1 -1
- package/lib/iam/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ import * as i1$4 from '@angular/platform-browser';
|
|
|
22
22
|
import { v4 } from 'uuid';
|
|
23
23
|
import * as i4 from '@azure/msal-angular';
|
|
24
24
|
import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG, MSAL_INSTANCE, MsalService, MsalBroadcastService, MsalModule } from '@azure/msal-angular';
|
|
25
|
-
import { EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError,
|
|
25
|
+
import { BrowserUtils, EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PromptValue, PublicClientApplication, LogLevel } from '@azure/msal-browser';
|
|
26
26
|
import * as i1$6 from '@fortawesome/angular-fontawesome';
|
|
27
27
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
28
28
|
import * as i1$7 from '@progress/kendo-angular-pager';
|
|
@@ -2455,6 +2455,9 @@ const MSALStorageKeys = {
|
|
|
2455
2455
|
};
|
|
2456
2456
|
class MSALStorage {
|
|
2457
2457
|
static saveRedirectState(redirectTo, calledBy) {
|
|
2458
|
+
if (redirectTo.indexOf('iam') >= 0) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2458
2461
|
localStorage.setItem(MSALStorageKeys.redirectTo, redirectTo);
|
|
2459
2462
|
console.log(`msal.app: redirect state saved: ${redirectTo}. Called by: ${calledBy}`);
|
|
2460
2463
|
}
|
|
@@ -2497,6 +2500,137 @@ class MSALRedirect {
|
|
|
2497
2500
|
}
|
|
2498
2501
|
}
|
|
2499
2502
|
|
|
2503
|
+
/*
|
|
2504
|
+
<file>
|
|
2505
|
+
Project:
|
|
2506
|
+
@osovitny/anatoly
|
|
2507
|
+
|
|
2508
|
+
Authors:
|
|
2509
|
+
Vadim Osovitny vadim@osovitny.com
|
|
2510
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
2511
|
+
|
|
2512
|
+
Created:
|
|
2513
|
+
27 Nov 2023
|
|
2514
|
+
|
|
2515
|
+
Description:
|
|
2516
|
+
Identity and Access Management
|
|
2517
|
+
|
|
2518
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2519
|
+
</file>
|
|
2520
|
+
*/
|
|
2521
|
+
//Node
|
|
2522
|
+
class MSALUtils {
|
|
2523
|
+
static isB2C() {
|
|
2524
|
+
if (MSALB2CConfig) {
|
|
2525
|
+
return true;
|
|
2526
|
+
}
|
|
2527
|
+
return false;
|
|
2528
|
+
}
|
|
2529
|
+
// Don't perform initial navigation in iframes or popups
|
|
2530
|
+
static initialNavigation() {
|
|
2531
|
+
return !BrowserUtils.isInIframe() && !BrowserUtils.isInPopup() ? 'enabledNonBlocking' : 'disabled';
|
|
2532
|
+
}
|
|
2533
|
+
static getApis() {
|
|
2534
|
+
let map = new Map();
|
|
2535
|
+
for (const api of MSALApiConfig) {
|
|
2536
|
+
map.set(api.uri, api.scopes);
|
|
2537
|
+
}
|
|
2538
|
+
return map;
|
|
2539
|
+
}
|
|
2540
|
+
static getApiScopes() {
|
|
2541
|
+
let scopes = [];
|
|
2542
|
+
for (const api of MSALApiConfig) {
|
|
2543
|
+
for (const scope of api.scopes) {
|
|
2544
|
+
scopes.push(scope);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
return scopes;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/*
|
|
2552
|
+
<file>
|
|
2553
|
+
Project:
|
|
2554
|
+
@osovitny/anatoly
|
|
2555
|
+
|
|
2556
|
+
Authors:
|
|
2557
|
+
Vadim Osovitny vadim@osovitny.com
|
|
2558
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
2559
|
+
|
|
2560
|
+
Created:
|
|
2561
|
+
20 Sep 2023
|
|
2562
|
+
|
|
2563
|
+
Description:
|
|
2564
|
+
Identity and Access Management
|
|
2565
|
+
|
|
2566
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2567
|
+
</file>
|
|
2568
|
+
*/
|
|
2569
|
+
//App
|
|
2570
|
+
class MSALB2C {
|
|
2571
|
+
static getAuthorityByType(type) {
|
|
2572
|
+
let policy = MSALB2C.getPolicyByType(type);
|
|
2573
|
+
return policy?.authority;
|
|
2574
|
+
}
|
|
2575
|
+
static getPolicyByType(type) {
|
|
2576
|
+
let policies = MSALB2CConfig?.policies;
|
|
2577
|
+
if (!policies) {
|
|
2578
|
+
return null;
|
|
2579
|
+
}
|
|
2580
|
+
for (let i = 0; i < policies.length; i++) {
|
|
2581
|
+
let policy = policies[i];
|
|
2582
|
+
if (policy.type == type) {
|
|
2583
|
+
return policy;
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
return null;
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
/*
|
|
2591
|
+
<file>
|
|
2592
|
+
Project:
|
|
2593
|
+
@osovitny/anatoly
|
|
2594
|
+
|
|
2595
|
+
Authors:
|
|
2596
|
+
Vadim Osovitny vadim@osovitny.com
|
|
2597
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
2598
|
+
|
|
2599
|
+
Created:
|
|
2600
|
+
20 Sep 2023
|
|
2601
|
+
|
|
2602
|
+
Description:
|
|
2603
|
+
Identity and Access Management
|
|
2604
|
+
|
|
2605
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2606
|
+
</file>
|
|
2607
|
+
*/
|
|
2608
|
+
const PolicyType = {
|
|
2609
|
+
signUpSignIn: 'signUpSignIn',
|
|
2610
|
+
signUp: 'signUp',
|
|
2611
|
+
editProfile: 'editProfile',
|
|
2612
|
+
resetPassword: 'resetPassword'
|
|
2613
|
+
};
|
|
2614
|
+
|
|
2615
|
+
/*
|
|
2616
|
+
<file>
|
|
2617
|
+
Project:
|
|
2618
|
+
@osovitny/anatoly
|
|
2619
|
+
|
|
2620
|
+
Authors:
|
|
2621
|
+
Vadim Osovitny vadim@osovitny.com
|
|
2622
|
+
Anatoly Osovitny anatoly@osovitny.com
|
|
2623
|
+
|
|
2624
|
+
Created:
|
|
2625
|
+
20 Sep 2023
|
|
2626
|
+
|
|
2627
|
+
Description:
|
|
2628
|
+
Identity and Access Management
|
|
2629
|
+
|
|
2630
|
+
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2631
|
+
</file>
|
|
2632
|
+
*/
|
|
2633
|
+
|
|
2500
2634
|
class AuthService extends ApiServiceBase {
|
|
2501
2635
|
http;
|
|
2502
2636
|
router;
|
|
@@ -2531,8 +2665,10 @@ class AuthService extends ApiServiceBase {
|
|
|
2531
2665
|
}
|
|
2532
2666
|
setDefaults() {
|
|
2533
2667
|
}
|
|
2668
|
+
/*
|
|
2669
|
+
https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular-b2c-sample-app/src/app/app.component.ts
|
|
2670
|
+
*/
|
|
2534
2671
|
initMSAL() {
|
|
2535
|
-
this.msalService.instance.enableAccountStorageEvents();
|
|
2536
2672
|
this.msalService.handleRedirectObservable().subscribe({
|
|
2537
2673
|
next: (result) => {
|
|
2538
2674
|
console.log(`msal.app: handleRedirectObservable`);
|
|
@@ -2541,35 +2677,106 @@ class AuthService extends ApiServiceBase {
|
|
|
2541
2677
|
console.log(error);
|
|
2542
2678
|
}
|
|
2543
2679
|
});
|
|
2544
|
-
this.
|
|
2545
|
-
|
|
2680
|
+
this.msalService.instance.enableAccountStorageEvents();
|
|
2681
|
+
this.msalBroadcastService.msalSubject$.pipe(filter((msg) => msg.eventType === EventType.INITIALIZE_END ||
|
|
2682
|
+
//ACCOUNT_ADDED and ACCOUNT_REMOVED events emitted when a user logs in or out of another tab or window
|
|
2546
2683
|
msg.eventType === EventType.ACCOUNT_ADDED ||
|
|
2547
2684
|
msg.eventType === EventType.ACCOUNT_REMOVED ||
|
|
2548
|
-
|
|
2685
|
+
//Login Failure
|
|
2549
2686
|
msg.eventType === EventType.LOGIN_FAILURE ||
|
|
2687
|
+
msg.eventType === EventType.ACQUIRE_TOKEN_FAILURE ||
|
|
2688
|
+
//LogOut
|
|
2550
2689
|
msg.eventType === EventType.LOGOUT_SUCCESS ||
|
|
2551
|
-
|
|
2690
|
+
//LogIn
|
|
2691
|
+
msg.eventType === EventType.LOGIN_SUCCESS ||
|
|
2692
|
+
msg.eventType === EventType.ACQUIRE_TOKEN_SUCCESS ||
|
|
2693
|
+
msg.eventType === EventType.SSO_SILENT_SUCCESS), takeUntil(this.msalDestroying$))
|
|
2552
2694
|
.subscribe((msg) => {
|
|
2695
|
+
//B2C
|
|
2696
|
+
let signUpSignIn = MSALB2C.getPolicyByType(PolicyType.signUpSignIn);
|
|
2697
|
+
let editProfile = MSALB2C.getPolicyByType(PolicyType.editProfile);
|
|
2698
|
+
let resetPassword = MSALB2C.getPolicyByType(PolicyType.resetPassword);
|
|
2553
2699
|
switch (msg.eventType) {
|
|
2554
2700
|
case EventType.INITIALIZE_END:
|
|
2555
2701
|
console.log(`msal.app: INITIALIZE_END fired`);
|
|
2556
2702
|
break;
|
|
2557
2703
|
case EventType.ACCOUNT_ADDED:
|
|
2704
|
+
case EventType.ACCOUNT_REMOVED:
|
|
2705
|
+
if (this.msalService.instance.getAllAccounts().length === 0) {
|
|
2706
|
+
window.location.pathname = "/";
|
|
2707
|
+
}
|
|
2708
|
+
break;
|
|
2709
|
+
case EventType.LOGIN_FAILURE:
|
|
2710
|
+
case EventType.ACQUIRE_TOKEN_FAILURE:
|
|
2711
|
+
if (!MSALUtils.isB2C()) {
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2714
|
+
//Check for forgot password error. Learn more about AAD error codes at
|
|
2715
|
+
//https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-aadsts-error-codes
|
|
2716
|
+
if (msg.error && msg.error.message.indexOf('AADB2C90118') > -1) {
|
|
2717
|
+
let resetPasswordFlowRequest = {
|
|
2718
|
+
authority: resetPassword.authority,
|
|
2719
|
+
scopes: [],
|
|
2720
|
+
};
|
|
2721
|
+
this.login(resetPasswordFlowRequest);
|
|
2722
|
+
}
|
|
2723
|
+
;
|
|
2724
|
+
break;
|
|
2558
2725
|
case EventType.LOGIN_SUCCESS:
|
|
2726
|
+
case EventType.ACQUIRE_TOKEN_SUCCESS:
|
|
2727
|
+
case EventType.SSO_SILENT_SUCCESS:
|
|
2559
2728
|
let payload = msg.payload;
|
|
2560
|
-
if (payload) {
|
|
2729
|
+
if (!payload) {
|
|
2730
|
+
return;
|
|
2731
|
+
}
|
|
2732
|
+
if (!MSALUtils.isB2C()) {
|
|
2561
2733
|
this.msalService.instance.setActiveAccount(payload.account);
|
|
2734
|
+
return;
|
|
2562
2735
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2736
|
+
//B2C
|
|
2737
|
+
let idtoken = payload.idTokenClaims;
|
|
2738
|
+
/**
|
|
2739
|
+
*
|
|
2740
|
+
* signUpSignIn
|
|
2741
|
+
*
|
|
2742
|
+
*/
|
|
2743
|
+
if (idtoken.acr === signUpSignIn.name || idtoken.tfp === signUpSignIn.name) {
|
|
2744
|
+
this.msalService.instance.setActiveAccount(payload.account);
|
|
2745
|
+
}
|
|
2746
|
+
/**
|
|
2747
|
+
*
|
|
2748
|
+
* editProfile
|
|
2749
|
+
*
|
|
2750
|
+
* For the purpose of setting an active account for UI update, we want to consider only the auth response resulting
|
|
2751
|
+
* from SUSI flow. "acr" claim in the id token tells us the policy (NOTE: newer policies may use the "tfp" claim instead).
|
|
2752
|
+
* To learn more about B2C tokens, visit https://docs.microsoft.com/en-us/azure/active-directory-b2c/tokens-overview
|
|
2753
|
+
*/
|
|
2754
|
+
if (idtoken.acr === editProfile.name || idtoken.tfp === editProfile.name) {
|
|
2755
|
+
const signInAccount = this.msalService.instance.getAllAccounts()
|
|
2756
|
+
.find((account) => account.idTokenClaims?.oid === idtoken.oid &&
|
|
2757
|
+
account.idTokenClaims?.sub === idtoken.sub &&
|
|
2758
|
+
(account.idTokenClaims.acr === signUpSignIn.name ||
|
|
2759
|
+
account.idTokenClaims.tfp === signUpSignIn.name));
|
|
2760
|
+
this.forceReauthenticate(signInAccount);
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
*
|
|
2764
|
+
* resetPassword
|
|
2765
|
+
*
|
|
2766
|
+
* Below we are checking if the user is returning from the reset password flow.
|
|
2767
|
+
* If so, we will ask the user to reauthenticate with their new password.
|
|
2768
|
+
* If you do not want this behavior and prefer your users to stay signed in instead,
|
|
2769
|
+
* you can replace the code below with the same pattern used for handling the return from
|
|
2770
|
+
* profile edit flow
|
|
2771
|
+
*/
|
|
2772
|
+
if (idtoken.acr === resetPassword.name || idtoken.tfp === resetPassword.name) {
|
|
2773
|
+
this.forceReauthenticate();
|
|
2567
2774
|
}
|
|
2568
2775
|
break;
|
|
2569
2776
|
}
|
|
2777
|
+
return msg;
|
|
2570
2778
|
});
|
|
2571
|
-
this.msalBroadcastService.inProgress
|
|
2572
|
-
.pipe(filter((status) => status === InteractionStatus.Startup ||
|
|
2779
|
+
this.msalBroadcastService.inProgress$.pipe(filter((status) => status === InteractionStatus.Startup ||
|
|
2573
2780
|
status === InteractionStatus.None), takeUntil(this.msalDestroying$))
|
|
2574
2781
|
.subscribe((status) => {
|
|
2575
2782
|
switch (status) {
|
|
@@ -2661,7 +2868,21 @@ class AuthService extends ApiServiceBase {
|
|
|
2661
2868
|
}
|
|
2662
2869
|
return this.acquireToken();
|
|
2663
2870
|
}
|
|
2664
|
-
|
|
2871
|
+
forceReauthenticate(account) {
|
|
2872
|
+
if (MSALUtils.isB2C()) {
|
|
2873
|
+
let signUpSignIn = MSALB2C.getPolicyByType(PolicyType.signUpSignIn);
|
|
2874
|
+
let signUpSignInFlowRequest = {
|
|
2875
|
+
authority: signUpSignIn.authority,
|
|
2876
|
+
scopes: [],
|
|
2877
|
+
prompt: PromptValue.LOGIN,
|
|
2878
|
+
account: account
|
|
2879
|
+
};
|
|
2880
|
+
this.login(signUpSignInFlowRequest);
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
login(userFlowRequest, popup) {
|
|
2665
2886
|
let authRequestCfg = this.msalGuardConfig.authRequest;
|
|
2666
2887
|
let authRequest = null;
|
|
2667
2888
|
if (authRequestCfg) {
|
|
@@ -2669,37 +2890,37 @@ class AuthService extends ApiServiceBase {
|
|
|
2669
2890
|
}
|
|
2670
2891
|
if (this.isPopup(popup)) {
|
|
2671
2892
|
if (authRequest) {
|
|
2672
|
-
|
|
2893
|
+
this.msalService.loginPopup({ ...authRequest, ...userFlowRequest }).subscribe((response) => {
|
|
2673
2894
|
this.msalService.instance.setActiveAccount(response.account);
|
|
2674
|
-
})
|
|
2895
|
+
});
|
|
2675
2896
|
}
|
|
2676
2897
|
else {
|
|
2677
|
-
|
|
2898
|
+
this.msalService.loginPopup(userFlowRequest).subscribe((response) => {
|
|
2678
2899
|
this.msalService.instance.setActiveAccount(response.account);
|
|
2679
|
-
})
|
|
2900
|
+
});
|
|
2680
2901
|
}
|
|
2681
2902
|
}
|
|
2682
2903
|
else {
|
|
2683
2904
|
if (authRequest) {
|
|
2684
|
-
|
|
2905
|
+
this.msalService.loginRedirect({ ...this.msalGuardConfig.authRequest, ...userFlowRequest });
|
|
2685
2906
|
}
|
|
2686
2907
|
else {
|
|
2687
|
-
|
|
2908
|
+
this.msalService.loginRedirect(userFlowRequest);
|
|
2688
2909
|
}
|
|
2689
2910
|
}
|
|
2690
2911
|
}
|
|
2691
2912
|
logout(popup) {
|
|
2692
2913
|
let activeAccount = this.getActiveAccount();
|
|
2693
2914
|
if (!activeAccount) {
|
|
2694
|
-
return
|
|
2915
|
+
return;
|
|
2695
2916
|
}
|
|
2696
2917
|
if (this.isPopup(popup)) {
|
|
2697
|
-
|
|
2918
|
+
this.msalService.logoutPopup({ account: activeAccount, mainWindowRedirectUri: "/" }).subscribe(() => {
|
|
2698
2919
|
this.appContext.clearWebStorage();
|
|
2699
|
-
})
|
|
2920
|
+
});
|
|
2700
2921
|
}
|
|
2701
2922
|
else {
|
|
2702
|
-
|
|
2923
|
+
this.msalService.logoutRedirect({ account: activeAccount }).pipe(map$1(() => {
|
|
2703
2924
|
this.appContext.clearWebStorage();
|
|
2704
2925
|
}));
|
|
2705
2926
|
}
|
|
@@ -2819,46 +3040,6 @@ class AuthenticationGuard extends MsalGuard {
|
|
|
2819
3040
|
</file>
|
|
2820
3041
|
*/
|
|
2821
3042
|
|
|
2822
|
-
/*
|
|
2823
|
-
<file>
|
|
2824
|
-
Project:
|
|
2825
|
-
@osovitny/anatoly
|
|
2826
|
-
|
|
2827
|
-
Authors:
|
|
2828
|
-
Vadim Osovitny vadim@osovitny.com
|
|
2829
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
2830
|
-
|
|
2831
|
-
Created:
|
|
2832
|
-
27 Nov 2023
|
|
2833
|
-
|
|
2834
|
-
Description:
|
|
2835
|
-
Identity and Access Management
|
|
2836
|
-
|
|
2837
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
2838
|
-
</file>
|
|
2839
|
-
*/
|
|
2840
|
-
//Node
|
|
2841
|
-
class MSALUtils {
|
|
2842
|
-
// Don't perform initial navigation in iframes or popups
|
|
2843
|
-
static initialNavigation() {
|
|
2844
|
-
return !BrowserUtils.isInIframe() && !BrowserUtils.isInPopup() ? 'enabledNonBlocking' : 'disabled';
|
|
2845
|
-
}
|
|
2846
|
-
static getApis() {
|
|
2847
|
-
let map = new Map();
|
|
2848
|
-
for (const api of MSALApiConfig) {
|
|
2849
|
-
map.set(api.uri, api.scopes);
|
|
2850
|
-
}
|
|
2851
|
-
return map;
|
|
2852
|
-
}
|
|
2853
|
-
static getApiScopes() {
|
|
2854
|
-
let scopes = [];
|
|
2855
|
-
for (const api of MSALApiConfig) {
|
|
2856
|
-
scopes.push(api.scopes);
|
|
2857
|
-
}
|
|
2858
|
-
return scopes;
|
|
2859
|
-
}
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
3043
|
/*
|
|
2863
3044
|
<file>
|
|
2864
3045
|
Project:
|
|
@@ -5959,92 +6140,6 @@ class AnatolyDataModule {
|
|
|
5959
6140
|
}], null, null); })();
|
|
5960
6141
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AnatolyDataModule, { imports: [CommonModule] }); })();
|
|
5961
6142
|
|
|
5962
|
-
/*
|
|
5963
|
-
<file>
|
|
5964
|
-
Project:
|
|
5965
|
-
@osovitny/anatoly
|
|
5966
|
-
|
|
5967
|
-
Authors:
|
|
5968
|
-
Vadim Osovitny vadim@osovitny.com
|
|
5969
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
5970
|
-
|
|
5971
|
-
Created:
|
|
5972
|
-
20 Sep 2023
|
|
5973
|
-
|
|
5974
|
-
Description:
|
|
5975
|
-
Identity and Access Management
|
|
5976
|
-
|
|
5977
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
5978
|
-
</file>
|
|
5979
|
-
*/
|
|
5980
|
-
//App
|
|
5981
|
-
class MSALB2C {
|
|
5982
|
-
static isEnabled() {
|
|
5983
|
-
if (MSALB2CConfig) {
|
|
5984
|
-
return true;
|
|
5985
|
-
}
|
|
5986
|
-
return false;
|
|
5987
|
-
}
|
|
5988
|
-
static getAuthorityByType(type) {
|
|
5989
|
-
let policy = MSALB2C.getPolicyByType(type);
|
|
5990
|
-
return policy?.authority;
|
|
5991
|
-
}
|
|
5992
|
-
static getPolicyByType(type) {
|
|
5993
|
-
let policies = MSALB2CConfig.policies;
|
|
5994
|
-
for (let i = 0; i < policies.length; i++) {
|
|
5995
|
-
let policy = policies[i];
|
|
5996
|
-
if (policy.type == type) {
|
|
5997
|
-
return policy;
|
|
5998
|
-
}
|
|
5999
|
-
}
|
|
6000
|
-
return null;
|
|
6001
|
-
}
|
|
6002
|
-
}
|
|
6003
|
-
|
|
6004
|
-
/*
|
|
6005
|
-
<file>
|
|
6006
|
-
Project:
|
|
6007
|
-
@osovitny/anatoly
|
|
6008
|
-
|
|
6009
|
-
Authors:
|
|
6010
|
-
Vadim Osovitny vadim@osovitny.com
|
|
6011
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
6012
|
-
|
|
6013
|
-
Created:
|
|
6014
|
-
20 Sep 2023
|
|
6015
|
-
|
|
6016
|
-
Description:
|
|
6017
|
-
Identity and Access Management
|
|
6018
|
-
|
|
6019
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
6020
|
-
</file>
|
|
6021
|
-
*/
|
|
6022
|
-
const PolicyType = {
|
|
6023
|
-
signUpSignIn: 'signUpSignIn',
|
|
6024
|
-
signUp: 'signUp',
|
|
6025
|
-
resetPassword: 'resetPassword',
|
|
6026
|
-
editProfile: 'editProfile'
|
|
6027
|
-
};
|
|
6028
|
-
|
|
6029
|
-
/*
|
|
6030
|
-
<file>
|
|
6031
|
-
Project:
|
|
6032
|
-
@osovitny/anatoly
|
|
6033
|
-
|
|
6034
|
-
Authors:
|
|
6035
|
-
Vadim Osovitny vadim@osovitny.com
|
|
6036
|
-
Anatoly Osovitny anatoly@osovitny.com
|
|
6037
|
-
|
|
6038
|
-
Created:
|
|
6039
|
-
20 Sep 2023
|
|
6040
|
-
|
|
6041
|
-
Description:
|
|
6042
|
-
Identity and Access Management
|
|
6043
|
-
|
|
6044
|
-
Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
|
|
6045
|
-
</file>
|
|
6046
|
-
*/
|
|
6047
|
-
|
|
6048
6143
|
/*
|
|
6049
6144
|
<file>
|
|
6050
6145
|
Project:
|
|
@@ -6119,7 +6214,7 @@ function MSALInstanceFactory() {
|
|
|
6119
6214
|
}
|
|
6120
6215
|
}
|
|
6121
6216
|
};
|
|
6122
|
-
if (
|
|
6217
|
+
if (MSALUtils.isB2C()) {
|
|
6123
6218
|
configuration.auth.authority = MSALB2C.getAuthorityByType(PolicyType.signUpSignIn);
|
|
6124
6219
|
configuration.auth.knownAuthorities = [MSALB2CConfig.authorityDomain];
|
|
6125
6220
|
}
|