Skip to content

Commit 3fb6462

Browse files
committed
2 parents 0e6e9af + 7a1ac45 commit 3fb6462

File tree

25 files changed

+30568
-3920
lines changed

25 files changed

+30568
-3920
lines changed
Lines changed: 66 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,82 @@
11
/**
2-
* Configuration object to be passed to MSAL instance on creation.
2+
* Enter here the user flows and custom policies for your B2C application
3+
* To learn more about user flows, visit: https://docs.microsoft.com/en-us/azure/active-directory-b2c/user-flow-overview
4+
* To learn more about custom policies, visit: https://docs.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-overview
5+
*/
6+
const b2cPolicies = {
7+
names: {
8+
signUpSignIn: 'B2C_1_susi_v2',
9+
forgotPassword: 'B2C_1_reset_v3',
10+
editProfile: 'B2C_1_edit_profile_v2',
11+
},
12+
authorities: {
13+
signUpSignIn: {
14+
authority: 'https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/B2C_1_susi_v2',
15+
},
16+
forgotPassword: {
17+
authority: 'https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/B2C_1_reset_v3',
18+
},
19+
editProfile: {
20+
authority: 'https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/B2C_1_edit_profile_v2',
21+
},
22+
},
23+
authorityDomain: 'fabrikamb2c.b2clogin.com',
24+
};
25+
26+
/**
27+
* Configuration object to be passed to MSAL instance on creation.
328
* For a full list of MSAL.js configuration parameters, visit:
429
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
530
* For more details on MSAL.js and Azure AD B2C, visit:
6-
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/working-with-b2c.md
31+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/working-with-b2c.md
732
*/
833

934
const msalConfig = {
1035
auth: {
11-
clientId: "2fdd06f3-7b34-49a3-a78b-0cf1dd87878e", // Replace with your AppID/ClientID obtained from Azure Portal.
12-
authority: b2cPolicies.authorities.signUpSignIn.authority, // Choose sign-up/sign-in user-flow as your default.
13-
knownAuthorities: [b2cPolicies.authorityDomain], // You must identify your tenant's domain as a known authority.
14-
redirectUri: "http://localhost:6420", // You must register this URI on Azure Portal/App Registration. Defaults to "window.location.href".
15-
postLogoutRedirectUri: "http://localhost:6420/signout", // Simply remove this line if you would like navigate to index page after logout.
16-
navigateToLoginRequestUrl: false, // If "true", will navigate back to the original request location before processing the auth code response.
36+
clientId: '2fdd06f3-7b34-49a3-a78b-0cf1dd87878e', // Replace with your AppID/ClientID obtained from Azure Portal.
37+
authority: b2cPolicies.authorities.signUpSignIn.authority, // Choose sign-up/sign-in user-flow as your default.
38+
knownAuthorities: [b2cPolicies.authorityDomain], // You must identify your tenant's domain as a known authority.
39+
redirectUri: '/', // You must register this URI on Azure Portal/App Registration. Defaults to "window.location.href".
40+
postLogoutRedirectUri: '/signout', // Simply remove this line if you would like navigate to index page after logout.
41+
navigateToLoginRequestUrl: false, // If "true", will navigate back to the original request location before processing the auth code response.
1742
},
1843
cache: {
19-
cacheLocation: "localStorage", // Configures cache location. "sessionStorage" is more secure, but "localStorage" gives you SSO.
20-
storeAuthStateInCookie: false, // If you wish to store cache items in cookies as well as browser cache, set this to "true".
44+
cacheLocation: 'localStorage', // Configures cache location. "sessionStorage" is more secure, but "localStorage" gives you SSO.
45+
storeAuthStateInCookie: false, // If you wish to store cache items in cookies as well as browser cache, set this to "true".
2146
},
2247
system: {
23-
loggerOptions: {
24-
loggerCallback: (level, message, containsPii) => {
25-
if (containsPii) {
26-
return;
27-
}
28-
switch (level) {
29-
case msal.LogLevel.Error:
30-
console.error(message);
31-
return;
32-
case msal.LogLevel.Info:
33-
console.info(message);
34-
return;
35-
case msal.LogLevel.Verbose:
36-
console.debug(message);
37-
return;
38-
case msal.LogLevel.Warning:
39-
console.warn(message);
40-
return;
41-
}
42-
}
43-
}
44-
}
45-
};
46-
48+
loggerOptions: {
49+
loggerCallback: (level, message, containsPii) => {
50+
if (containsPii) {
51+
return;
52+
}
53+
switch (level) {
54+
case msal.LogLevel.Error:
55+
console.error(message);
56+
return;
57+
case msal.LogLevel.Info:
58+
console.info(message);
59+
return;
60+
case msal.LogLevel.Verbose:
61+
console.debug(message);
62+
return;
63+
case msal.LogLevel.Warning:
64+
console.warn(message);
65+
return;
66+
}
67+
},
68+
},
69+
},
70+
};
71+
4772
/**
4873
* Scopes you add here will be prompted for user consent during sign-in.
4974
* By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request.
50-
* For more information about OIDC scopes, visit:
75+
* For more information about OIDC scopes, visit:
5176
* https://docs.microsoft.com/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes
5277
*/
5378
const loginRequest = {
54-
scopes: ["openid", "offline_access"],
79+
scopes: ['openid', 'offline_access'],
5580
};
5681

5782
/**
@@ -66,7 +91,8 @@ const loginRequest = {
6691

6792
// exporting config object for jest
6893
if (typeof exports !== 'undefined') {
69-
module.exports = {
70-
msalConfig: msalConfig,
71-
};
72-
}
94+
module.exports = {
95+
msalConfig: msalConfig,
96+
b2cPolicies: b2cPolicies,
97+
};
98+
}

0 commit comments

Comments
 (0)