Skip to content

Commit 6a94f73

Browse files
committed
respond to comments
1 parent dd0f045 commit 6a94f73

File tree

5 files changed

+8
-42
lines changed

5 files changed

+8
-42
lines changed

1-Authentication/2-sign-in-b2c/App/authPopup.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ myMSALObj.addEventCallback((event) => {
2424
.getAllAccounts()
2525
.find(
2626
(account) =>
27-
account.idTokenClaims.oid === event.payload.idTokenClaims.oid &&
2827
account.idTokenClaims.sub === event.payload.idTokenClaims.sub &&
2928
account.idTokenClaims['tfp'] === b2cPolicies.names.signUpSignIn
3029
);
@@ -35,7 +34,10 @@ myMSALObj.addEventCallback((event) => {
3534
};
3635

3736
// silently login again with the signUpSignIn policy
38-
myMSALObj.ssoSilent(signUpSignInFlowRequest).catch((error) => {
37+
myMSALObj.ssoSilent(signUpSignInFlowRequest)
38+
.then(() => {
39+
// window.location.reload();
40+
}).catch((error) => {
3941
console.log(error);
4042
if (error instanceof msal.InteractionRequiredAuthError) {
4143
myMSALObj.loginPopup({

1-Authentication/2-sign-in-b2c/App/authRedirect.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ myMSALObj.addEventCallback((event) => {
3535
};
3636

3737
// silently login again with the signUpSignIn policy
38-
myMSALObj.ssoSilent(signUpSignInFlowRequest).catch((error) => {
38+
myMSALObj.ssoSilent(signUpSignInFlowRequest)
39+
.redirect(() => {
40+
window.location.reload();
41+
}).catch((error) => {
3942
console.log(error);
4043
if (error instanceof msal.InteractionRequiredAuthError) {
4144
myMSALObj.loginRedirect({

1-Authentication/2-sign-in-b2c/package-lock.json

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1-Authentication/2-sign-in-b2c/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"homepage": "https://github.com/Azure-Samples/ms-identity-javascript-tutorial#readme",
3131
"dependencies": {
3232
"express": "^4.17.1",
33-
"express-rate-limit": "^6.7.0",
3433
"morgan": "^1.10.0"
3534
},
3635
"devDependencies": {

1-Authentication/2-sign-in-b2c/server.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,11 @@ const express = require('express');
22
const morgan = require('morgan');
33
const path = require('path');
44

5-
const rateLimit = require('express-rate-limit');
6-
75
const DEFAULT_PORT = process.env.PORT || 6420;
86

97
// initialize express.
108
const app = express();
119

12-
/**
13-
* HTTP request handlers should not perform expensive operations such as accessing the file system,
14-
* executing an operating system command or interacting with a database without limiting the rate at
15-
* which requests are accepted. Otherwise, the application becomes vulnerable to denial-of-service attacks
16-
* where an attacker can cause the application to crash or become unresponsive by issuing a large number of
17-
* requests at the same time. For more information, visit: https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html
18-
*/
19-
const limiter = rateLimit({
20-
windowMs: 15 * 60 * 1000, // 15 minutes
21-
max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes)
22-
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
23-
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
24-
});
25-
26-
27-
// Apply the rate limiting middleware to all requests
28-
app.use(limiter);
29-
3010
// Configure morgan module to log all requests.
3111
app.use(morgan('dev'));
3212

0 commit comments

Comments
 (0)