凭证保留为空时,ADFS返回"SAML提供程序返回的响应程序错误:未指定"

Thi*_*ikx 7 authentication adfs saml passport.js passport-saml

我使用passport-saml在节点api中实现了ADFS SSO.登录有效但当我不放弃任何凭据并提交登录表单时,ADFS服务器会返回以下错误:

"SAML提供程序返回响应程序错误:未指定"

当我尝试再次登录后,ADFS直接返回到回调URL并再次弹出错误.

passport.use('saml', new SAMLStrategy({
    entryPoint: adfsEntryPoint,
    issuer: '{adfs-url}/login/adfs',
    callbackUrl: '{adfs-url}/login/adfs/callback',
    cert: "{CERT}",
    authnContext:'http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/windows',
    identifierFormat: null,
    signatureAlgorithm: 'sha256'
}, (profile, done) => {
    const upn = profile["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"];
    const windowsAccountName = profile["http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"];
    const user = new userModel.User(upn, "user");
    user.enabled = true;
    return done(null, user);
}));

passport.serializeUser((user, done) => {
    done(null, user);
});

passport.deserializeUser(function (user, done) {
    done(null, user);
});

router.get('/auth/adfs', passport.authenticate('saml', { failureRedirect: "/" }), (req, res) => {
    res.redirect('/');
});

router.get('/auth/adfs/callback', passport.authenticate('saml', { failureRedirect: "/" }), (req, res) => {
    res.redirect('/');
});
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 1

响应者只是 AD FS 表示 AD FS 出现问题。

要获取有关 AD FS 上发生的异常的更多信息,您应该查看 AD FS 服务器上的 AD FS 事件日志。

  1. 在 AD FS 服务器上打开事件查看器
  2. 转到应用程序和服务日志 --> AD FS
  3. 查找异常

还有很多关于如何设置 AD FS 跟踪的精彩文章,但您需要找到一篇针对正在使用的 AD FS 版本的文章。

希望这对您有帮助。