Passport-SAMLを自分のサイトに実装したので、サイトを他の 2 つの ID プロバイダーに接続することになりました。私のコードでは、SamlStrategy の最新の定義のみを使用しているようです。Passport を設定して、同じ戦略の複数の異なる実装を許可するにはどうすればよいですか?
私の実装は次のようになります。
passport.use(new SamlStrategy(
{
path: '/saml',
entryPoint: "https://idp.identityprovider.net/idp/profile/SAML2/Redirect/SSO",
issuer: 'https://www.serviceprovider.com/saml',
identifierFormat: 'urn:domain:safemls:nameid-format:loginid'
},
function(profile, done) {
console.log("SamlStrategy done", profile)
User.findOne({email:profile.Email}, function(err, user) {
if (err) {
return done(err);
}
if(!user) return done(null, false, {message: 'No account associated with this email.'})
return done(null, user);
});
}
));