Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit f151556

Browse files
committed
fix auth
1 parent 92089ea commit f151556

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports.branding = {
1212
orgHome: process.env.brandOrgHome || "https://acm.illinois.edu",
1313
statusURL: process.env.brandStatusURL || "https://status.acm.illinois.edu",
1414
copyrightOwner: process.env.brandCopyrightOwner || "ACM @ UIUC",
15-
domainHint: process.env.brandDomainHint || "acm.illinois.edu", // primary azure AD domain for tenant.
15+
domainHint: process.env.brandDomainHint, // primary azure AD domain for tenant.
1616
externalDomain: process.env.externalDomain || "https://go.acm.illinois.edu"
1717

1818
}

index.js

+8-19
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ app.get('/#',
313313
resourceURL: config.resourceURL, // optional. Provide a value if you want to specify the resource.
314314
customState: 'my_state', // optional. Provide a value if you want to provide custom state value.
315315
failureRedirect: '/error',
316-
domain_hint: config.branding.domainHint
316+
domain_hint: config.branding.domainHint,
317+
prompt: 'select_account'
317318
}
318319
)(req, res, next);
319320
},
@@ -326,22 +327,6 @@ app.get('/error', (req, res) => {
326327
app.get('/unauthorized', (req, res) => {
327328
return res.status(401).render('unauthorized.html', { partials, productName: config.branding.title, logoPath: config.branding.logoPath, copyrightOwner: config.branding.copyrightOwner, statusURL: config.branding.statusURL, orgHome: config.branding.orgHome, groups: config.groups_permitted.toString().replaceAll(",", "<br />"), adminGroups: config.admin_groups.toString().replaceAll(",", "<br />") });
328329
});
329-
// 'GET returnURL'
330-
// `passport.authenticate` will try to authenticate the content returned in
331-
// query (such as authorization code). If authentication fails, user will be
332-
// redirected to '/' (home page); otherwise, it passes to the next middleware.
333-
app.get('/auth/openid/return',
334-
function (req, res, next) {
335-
passport.authenticate('azuread-openidconnect',
336-
{
337-
response: res, // required
338-
failureRedirect: '/'
339-
}
340-
)(req, res, next);
341-
},
342-
function (req, res) {
343-
res.redirect('/');
344-
});
345330

346331
// 'POST returnURL'
347332
// `passport.authenticate` will try to authenticate the content returned in
@@ -351,8 +336,12 @@ app.post('/auth/openid/return',
351336
function (req, res, next) {
352337
passport.authenticate('azuread-openidconnect',
353338
{
354-
response: res, // required
355-
failureRedirect: '/'
339+
response: res, // required
340+
resourceURL: config.resourceURL, // optional. Provide a value if you want to specify the resource.
341+
customState: 'my_state', // optional. Provide a value if you want to provide custom state value.
342+
failureRedirect: '/error',
343+
domain_hint: config.branding.domainHint,
344+
prompt: 'select_account'
356345
}
357346
)(req, res, next);
358347
},

0 commit comments

Comments
 (0)