Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
passport-saml-encrypted
Advanced tools
A Passport strategy for handling encrypted SAML authentication responses
A strategy for Passport authentication that supports encrypted SAML responses.
This is largely a fork of https://github.com/bergie/passport-saml Which seems to be dormant.
It was created to support encrypted SAML responses.
Contributions welcome.
Documentation from the original forked repo follows:
This is a SAML 2.0 authentication provider for Passport, the Node.js authentication library.
The code was originally based on Michael Bosworth's express-saml library.
Passport-SAML has been tested to work with both SimpleSAMLphp based Identity Providers, and with Active Directory Federation Services.
$ npm install passport-saml-encrypted
This example utilizes the Feide OpenIdp identity provider. You need an account there to log in with this. You also need to register your site as a service provider.
The SAML identity provider will redirect you to the URL provided by the path
configuration.
passport.use(new SamlStrategy(
{
path: '/login/callback',
entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
issuer: 'passport-saml'
},
function(profile, done) {
findByEmail(profile.email, function(err, user) {
if (err) {
return done(err);
}
return done(null, user);
});
})
));
You need to provide a route corresponding to the path
configuration parameter given to the strategy:
app.post('/login/callback',
passport.authenticate('saml', { failureRedirect: '/', failureFlash: true }),
function(req, res) {
res.redirect('/');
}
);
Use passport.authenticate()
, specifying saml
as the strategy:
app.get('/login',
passport.authenticate('saml', { failureRedirect: '/', failureFlash: true }),
function(req, res) {
res.redirect('/');
}
);
Passport-SAML uses the HTTP Redirect Binding for its AuthnRequest
s, and expects to receive the messages back via the HTTP POST binding.
Authentication requests sent by Passport-SAML can be signed using RSA-SHA1. To sign them you need to provide a private key in the PEM format via the privateCert
configuration key. For example:
privateCert: fs.readFileSync('./cert.pem', 'utf-8')
It is a good idea to validate the incoming SAML Responses. For this, you can provide the Identity Provider's certificate using the cert
confguration key:
cert: 'MIICizCCAfQCCQCY8tKaMc0BMjANBgkqh ... W=='
If the response is encrypted, you need to supply your public key to the SAML provider, and use your private key to decrypt the response. This is specified as:
privateCert: fs.readFileSync('path/to/privkey.pem', 'utf-8')
Here is a configuration that has been proven to work with ADFS:
{
entryPoint: 'https://ad.example.net/adfs/ls/',
issuer: 'https://your-app.example.net/login/callback',
callbackUrl: 'https://your-app.example.net/login/callback',
cert: 'MIICizCCAfQCCQCY8tKaMc0BMjANBgkqh ... W==',
privateCert: fs.readFileSync('./ssl/privkey.pem', 'utf-8'), //need to generate key using openssl and put it in server
encryptedSAML:true,
identifierFormat:"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
}
Please note that ADFS needs to have a trust established to your service in order for this to work.
FAQs
A Passport strategy for handling encrypted SAML authentication responses
The npm package passport-saml-encrypted receives a total of 56 weekly downloads. As such, passport-saml-encrypted popularity was classified as not popular.
We found that passport-saml-encrypted demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.