Logout of Google IDP with Passport saml

305 views Asked by At

I am using passport-saml to authenticate users via Google IDP(SAML APP)

My SAML Strategy is configured as below

const samlStrategy = new SamlStrategy({
    protocol: PROTOCOL,
    entryPoint: SSO_URL, // SSO URL (Step 2)
    issuer: SP_ENTITY_ID, // Entity ID (Step 4)
    path: CALLBACK_PATH, // ACS URL path (Step 4)
    cert: IDP_CERT,
    logoutUrl: 'https://accounts.google.com/logout',
    logoutCallbackUrl: '/signout'
    
  }, function (profile, done) {
    done(null, JSON.parse(JSON.stringify(profile)))
  })
  passport.use(samlStrategy)

Using the Passport SAML Strategy, I am able to login successfully

On Logout, I am logging out of SAML Strategy as below

server.get('/logout', function (req, res) {
    try {
      req.user.nameID = req.user.nameID;
      req.user.nameIDFormat = req.user.nameIDFormat;
      samlStrategy.logout(req, function(err, requestUrl){
        if(err){
            return res.send({ success: false, error: err });
        }
        req.logout()
        req.session=null
        req.user=null
        return res.redirect(requestUrl);
      });
    } catch(error) {
      return res.send({ success: false, error });
    }
  })

This is logging me out of all Google accounts that are logged into the browser.

QUESTIONS:

  1. Is there a way to just logout only from the specific Google account that I have used for SAML Strategy?
  2. Logout callback url is also not called
0

There are 0 answers