diff options
author | foobarable | 2019-11-27 10:50:14 +0100 |
---|---|---|
committer | Ralph Krimmel | 2019-11-27 15:08:30 +0100 |
commit | 1881775379d9d1a358d1dc9762524723cc005673 (patch) | |
tree | e0a2310d55d0a2edc6bab3e8f86350b377fa62bf /lib/web | |
parent | 689f5a0a9583fdd774a271a9e6265ee5356d72a0 (diff) |
Fixing redirection after SAML login
Saving referer into session in SAML auth so passport can redirect correctly after SAML login.
Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
Diffstat (limited to 'lib/web')
-rw-r--r-- | lib/web/auth/saml/index.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/web/auth/saml/index.js b/lib/web/auth/saml/index.js index 40a6f8b3..1c80c934 100644 --- a/lib/web/auth/saml/index.js +++ b/lib/web/auth/saml/index.js @@ -7,6 +7,7 @@ const config = require('../../../config') const models = require('../../../models') const logger = require('../../../logger') const { urlencodedParser } = require('../../utils') +const { setReturnToFromReferer } = require('../utils') const fs = require('fs') const intersection = function (array1, array2) { return array1.filter((n) => array2.includes(n)) } @@ -76,11 +77,13 @@ passport.use(new SamlStrategy({ }) })) -samlAuth.get('/auth/saml', +samlAuth.get('/auth/saml',function(req,res,next) { + setReturnToFromReferer(req) passport.authenticate('saml', { successReturnToOrRedirect: config.serverURL + '/', failureRedirect: config.serverURL + '/' - }) + })(req,res,next) + } ) samlAuth.post('/auth/saml/callback', urlencodedParser, |