当用户登录到另一个租户时,带有 prompt=none 的 Azure AD 显示错误请求

Azure AD with prompt=none shows Bad Request when user is logged in into another tenant

我们有一个应用程序支持通过 OpenID Connect 隐式流使用我们的 Azure AD 租户帐户无缝登录。如果用户有权访问提供 Azure AD 颁发证据的应用程序 - 将自动授予访问权限,否则我们会显示常规应用程序登录屏幕。

每次需要用户身份验证时,我们都会将用户重定向到指定 prompt=none 的 Azure AD 登录页面 (https://login.microsoftonline.com/xyz)。

尊重ODIC specification这样的标志应该有以下效果。

The Authorization Server MUST NOT display any authentication or consent user interface pages. An error is returned if an End-User is not already authenticated or the Client does not have pre-configured consent for the requested Claims or does not fulfill other conditions for processing the request. The error code will typically be login_required, interaction_required. This can be used as a method to check for existing authentication and/or consent.

它通常按预期工作,但是,在某些情况下,Azure AD 登录页面 会向最终用户显示错误屏幕,并且发生在 用户登录到另一个 Azure AD 租户

User account '...' from identity provider 'https://sts.windows.net/.../' does not exist in tenant '...' and cannot access the application '...' in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.

问题是:

  1. 不违反ODIC规范吗?
  2. 如何为用户时尚无缝地妥善处理此类情况? (应用程序不负责重定向到 Azure AD 后发生的事情)。

是的,这违反了规范并且违背了 prompt=none 的目的,因为应用程序无法再控制用户体验。 @vibronet 或许可以直接在 MS 端创造记录。

虽然我也同意这违反了规范,但我可以提供解决方法吗?

我相信您也可以尝试指定 domain_hint 或 login_hint 参数来帮助系统确定有效会话。希望无论当前登录哪个会话用户,它都能给您正确的答案。

是的,这违反了 OIDC 规范。我们创建了一个错误。

如果错误只是因为 STS select 错误的会话而发生,您可以使用 login_hint 或 domain_hint 来帮助 STS select 正确会话。