Coder Social home page Coder Social logo

Comments (6)

vijaykotha avatar vijaykotha commented on July 28, 2024 5

var SamlStrategy = require('passport-saml').Strategy;
router.get('/logout', function(req, res) {

 return SamlStrategy.logout(req, function(err, uri) {
	 return res.redirect(uri);
 });

});

Please could anyone help me as I am getting the error
TypeError: SamlStrategy.logout is not a function

from passport-saml.

vhalthi avatar vhalthi commented on July 28, 2024 3

i have one issue, i am using cookieSession for passport-saml. i get the logout working but i have configured timeout, i get an error after timeout when user is trying to logout.

_

TypeError: Cannot read property 'nameIDFormat' of undefined.

_

TimeOut configuration:

app.use(cookieSession({ name: 'session', keys: ['keyHS'], maxAge: 10000 })); app.use(passport.initialize()); app.use(passport.session());

samlStrategy.logout(req, function(){
               req.logout();
               res.redirect('/');
           });

What should i do here to redirect the user to login page after timeout.

from passport-saml.

ploer avatar ploer commented on July 28, 2024 1

I just took over maintenance of this library in May, and I'm afraid I haven't gotten much into the logout functionality yet, but I'm happy to work with you on figuring it out.

Have you tried setting the logoutUrl option? I don't think it's documented, but you can see the implementation at saml.js:218.

You may also want to write out the contents of the logoutRequest being generated in saml.js:generateLogoutResponse() to make sure that looks appropriate.

from passport-saml.

halfmanhalfdonut avatar halfmanhalfdonut commented on July 28, 2024 1

Check out pull request #72 for a fix for the current implementation. You need a logoutUrl as well as entryPoint.

To actually get it to work on the IdP, you have to generate a logout request like

var samlStrategy = passport._strategy('saml');

samlStrategy.logout(req, function(err, requestUrl) {
    // LOCAL logout
    req.logout();
    // redirect to the IdP with the encrypted SAML logout request
    res.redirect(requestUrl);
});

You'd also need to have a callback from the IdP set up so they can redirect back to your site (wherever you want to have them go). Alternatively, you can have a generic exports.signout function that only does local logout and redirects to the homepage, and use a custom exports.samlSignout function that takes care of only the samlStrategy.logout call.

I have this working in a local app based on my fork in the Pull Request above. Good luck!

from passport-saml.

satblip avatar satblip commented on July 28, 2024

Works perfectly on my side, thanks @wambotron !

from passport-saml.

Amanuv19 avatar Amanuv19 commented on July 28, 2024

var SamlStrategy = require('passport-saml').Strategy;
router.get('/logout', function(req, res) {

 return SamlStrategy.logout(req, function(err, uri) {
	 return res.redirect(uri);
 });

});

Please could anyone help me as I am getting the error
TypeError: SamlStrategy.logout is not a function

FAcing the same error. Can anyone help

from passport-saml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.