【问题标题】:How to include acr_values in Passport authenticate如何在 Passport 身份验证中包含 acr_values
【发布时间】:2020-10-06 12:10:36
【问题描述】:

我已设置 Passport,并使用针对 Identity Server 4 的 oauth2 策略(代码流)工作。我需要在对 Identity Server 的调用中包含 acr_values(这在另一个客户端正确工作)。

我的理解(例如here 所示)是以下代码应该将 acr_values 添加到 auth 调用中:

app.get('/auth', (req, res, next) => {
  passport.authenticate('oidc', { acr_values: 'urn:grn:authn:fi:all' })(req, res, next);
});

但这不起作用。运行该示例中的代码也不起作用。

这是我做错了什么,还是改变了?

如何让护照在对身份服务器的调用中包含 acr_values?

【问题讨论】:

    标签: node.js express authentication passport.js identityserver4


    【解决方案1】:

    您使用的acr_values 格式无效,它必须是空格分隔的单个字符串,例如:acr_1 acr_2 tenant:tenant_value idp:idp_value

    Docs:

    acr_values 允许传入额外的身份验证相关信息 - 身份服务器特殊情况下,以下专有 acr_values:

    idp:name_of_idp 绕过登录/主页领域屏幕并将用户直接转发到选定的身份提供者(如果每个客户端配置允许)

    tenant:name_of_tenant 可用于将租户名称传递给登录 UI

    这里是它在代码中得到验证的地方:https://github.com/IdentityServer/IdentityServer4/blob/main/src/IdentityServer4/src/Validation/Default/AuthorizeRequestValidator.cs#L771

    测试示例:https://github.com/IdentityServer/IdentityServer4/blob/main/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/JwtRequestAuthorizeTests.cs#L667

    【讨论】:

      猜你喜欢
      • 2019-03-28
      • 2015-03-16
      • 2017-05-13
      • 2016-01-02
      • 2017-06-14
      • 2016-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多