node.jspassport-saml

Node JS and SAML example


I want to build sample app which will be protected using SAML for which I am trying to use passport-saml.

I found many sample programs online. But could not help to complete my sample program.

Is there a sample which is available with step by step explanations which I can follow up directly.

I am using SSOCircle as IDP which redirects me to SSO login page of SSOCircle but after login it shows error message

Error occurred Reason: Unable to do Single Sign On or Federation.

Following is my code in node.

passport.use(new SamlStrategy(
{
  path: '/login/callback',
  entryPoint: 'https://idp.ssocircle.com:443/sso/SSORedirect/metaAlias/publicidp',
  issuer: 'comuteAWS',
  cert: ''
},
function (profile, done) {
  return done(null,
    {
      id: profile.uid,
      email: profile.email,
      displayName: profile.cn,
      firstName: profile.givenName,
      lastName: profile.sn
    });
})

);

my SP metadata is following

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><EntityDescriptor entityID="comuteAWS" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"><SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"><NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat><AssertionConsumerService index="0" isDefault="true" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://192.168.254.38:3000/vehicles"/></SPSSODescriptor></EntityDescriptor>

Solution

  • I already did that but still it was not working. Finally I used wso2 identity provider and with same piece of code it worked.