Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google SAML #167

Closed
Crispy1975 opened this issue Sep 5, 2016 · 12 comments
Closed

Google SAML #167

Crispy1975 opened this issue Sep 5, 2016 · 12 comments

Comments

@Crispy1975
Copy link

Does passport-saml support Google SAML?

@springuper
Copy link

+1

@abelosorio
Copy link

Yes. It does.

passport.use(new SamlStrategy(
  {
    path: process.env.REACT_APP_SAML_PATH,
    entryPoint: process.env.REACT_APP_SAML_ENTRYPOINT,
    issuer: process.env.REACT_APP_SAML_ISSUER,
    cert: process.env.REACT_APP_SAML_CERT,
    identifierFormat: 'urn:oasis:names:tc:SAML:2.0:nameid-format:email',
    protocol: 'https://'
  },
  function(profile, done) {
    return done(null, {
      id: profile.uid,
      email: profile.email,
      displayName: profile.cn,
      firstName: profile.givenName,
      lastName: profile.sn
    });
  })
);

And (in app.js):

// @see https://github.com/bergie/passport-saml#provide-the-authentication-callback
app.get('/auth/sso-login', passport.authenticate(
  process.env.REACT_APP_PASSPORT_STRATEGY,
  {
    successRedirect: '/',
    failureRedirect: '/auth/login',
    failureFlash: true
  }
));

app.post(
  process.env.REACT_APP_SAML_PATH,
  passport.authenticate(
    process.env.REACT_APP_PASSPORT_STRATEGY,
    {
      failureRedirect: '/',
      failureFlash: true
    }
  ),
  (req, res) => {
    res.redirect('/');
  }
);

I've used passport, passport-saml, express-session, cookie-parser and body-parser.

Let me know if you need a hand.

@aby040
Copy link

aby040 commented Apr 17, 2018

@abelosorio Have you tried fetching user groups as part of the SAML response from google? I was able to add custom field to users which can be added in 'Attribute Mapping' section, but I could not find a way to fetch the groups the user belongs to (member-of)!

@abelosorio
Copy link

Hi @aby040!

No, I haven't done that. Sadly I'm not longer part of the project where I used Google SAML.

Sorry man, I cannot help this time :(

@ChakrapaniKulkarni
Copy link

How to extract the user profile from the samlstrategy callback.. we want to show the logged in user's name, email,..etc.. Any idea?

@FossPrime
Copy link

Yes. It does.

#501

Does failureRedirect get handled by the idp? With google if the user is only logged in with their personal account, we get a dead end 403 error page, our redirect is ignored. I know there is a passport-saml fork that handles this well with a googleAuth: true parameter.

@cjbarth
Copy link
Collaborator

cjbarth commented Oct 8, 2021

Do you know which fork? It would be nice to have that fork contribute back to this project if at all possible.

@FossPrime
Copy link

FossPrime commented Oct 8, 2021

@cjbarth it's old https://github.com/DmtrPn/passport-saml

DmtrPn@4487ed6

He took a tailor-made brute force approach to the problem... It would be more helpful to have a more general solution that might be useful even outside of Google... Like Microsoft, and foreign niche IDPs like GMX, Line etc or other edge cases, perhaps automated testing or staging and contractor accounts.

@cjbarth
Copy link
Collaborator

cjbarth commented Oct 8, 2021

I'm not sure what problems Google, Instagram, Twitter or others are facing using passport-saml, so I can't really say what is a good general solution. If you're interested in working on that, I'd be happy to help with guidance and code review.

@markstos
Copy link
Contributor

If you are using Google for identity, I would suggest using Google's OAuth option if possible. SAML continues to have security issues related to XML parsing. OAuth uses JSON and seems fewer security issues. I realize some service providers only support SAML, which is too bad.

@cjbarth
Copy link
Collaborator

cjbarth commented Oct 11, 2021

For completeness, OAuth has its own set of issues; never treat security as a slam-dunk, bolt-on, or drop-in. When it comes to XML parsing issues, it is very hard to exploit because that would mean that a private key of the IdP was leaked or you aren't using signing. If the key is leaked, then you have bigger problems, if you aren't signing, turn it on.

@markstos
Copy link
Contributor

@cjbarth fair points. My bias against XML colors my perspective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants