Skip to content

Commit 58d477b

Browse files
Bugfix: OIDC post login redirects (#2884)
* Added middleware to patch the express redirect function so that no-cache headers are set. This is because firefox caches redirects which affects our authentication flow * Added the post login url redirect url from the session into the query string during the oidc auth process so that it persists to the controller where we can use it.
1 parent b7b45c5 commit 58d477b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

typescript/api/controllers/UserController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export module Controllers {
109109
let postLoginUrl = null;
110110
if (req.session.redirUrl) {
111111
postLoginUrl = req.session.redirUrl;
112+
} else if (req.query.redirUrl) {
113+
postLoginUrl = req.query.redirUrl;
112114
} else {
113115
postLoginUrl = `${BrandingService.getBrandAndPortalPath(req)}/${ConfigService.getBrand(branding, 'auth').local.postLoginRedir}`;
114116
}

typescript/api/services/UsersService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ export module Services {
702702
} else {
703703
req.session.logoutUrl = sails.config.auth.postLogoutRedir
704704
}
705+
if(req.session.redirUrl != null) {
706+
//the session url changes after login so we lose this value if we don't put it on the queru string
707+
req.query.redirUrl = req.session.redirUrl;
708+
}
709+
705710
sails.log.verbose(`OIDC login success, tokenset: `);
706711
sails.log.verbose(JSON.stringify(tokenSet));
707712
sails.log.verbose(`Claims:`);

0 commit comments

Comments
 (0)