Skip to content

Commit

Permalink
fix #30 avoid double slash in CAS logout redirect URL
Browse files Browse the repository at this point in the history
  • Loading branch information
floriannari committed Oct 21, 2024
1 parent b50e085 commit a8f0a06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ module.exports = function(_passport) {
done(null, user);
});

passport.use(new(require('passport-apereo-cas').Strategy)(properties.esup.CAS, function(profile, done) {
const CAS = properties.esup.CAS;
if (!CAS.casBaseURL.endsWith('/')) {
CAS.casBaseURL += "/";
}

passport.use(new(require('passport-apereo-cas').Strategy)(CAS, function(profile, done) {
// console.log("profile : " + JSON.stringify(profile, null ,2));
return done(null, {uid:profile.user, attributes:profile.attributes});
}));
Expand Down
2 changes: 1 addition & 1 deletion server/routes/pagesRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ exports.routing = function(router, passport) {
router.get('/logout', function(req, res, next) {
req.logout(function(err) {
if (err) { return next(err); }
res.redirect(properties.esup.CAS.casBaseURL + '/logout');
res.redirect(properties.esup.CAS.casBaseURL + 'logout');
});
});
}

0 comments on commit a8f0a06

Please sign in to comment.