Azure AD B2C 密码重置

Jam*_*ood 6 azure azure-active-directory azure-ad-b2c

我试图了解如何使用 Azure AD B2C 密码重置。

似乎有多种方法可以处理密码重置。这些有什么区别?这些之间有价格差异吗?其中一些是 Azure AD 的功能,而一些是 Azure AD B2C 的功能?为什么下面的方法 3 似乎不起作用?

  1. 通过 Azure B2C 用户流(策略)。

    • 登录 v1 的策略转到下面的 AD 密码重置。
    • 虽然所有其他策略都适用于 B2C 密码重置,但允许用户通过存储在其用户配置文件中的主要电子邮件地址重置密码。
  2. 通过 Azure Active Directory 自助服务密码重置。可通过https://passwordreset.microsoftonline.com访问。这允许用户通过存储在其个人资料中的任何电子邮件地址重置其密码。

  3. 用户配置文件上的重置密码按钮。这提供了一个临时密码,但是临时密码似乎不起作用。

Way*_*ang 7

AAD B2C ? AAD ===> AAD B2C 用户?AAD用户

目前,我们在一般场景中只支持两种方式来重置 Azure AD B2C 用户的密码:

  1. 使用Azure AD B2C 密码重置策略/用户流程的自助服务重置密码 (SSPR)

  2. 管理员帮助用户使用Azure AD Graph API重置密码:https : //docs.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations#reset-a-users-password- ——

回答您的问题:

这些有什么区别?这些之间有价格差异吗?其中一些是 Azure AD 的功能,而一些是 Azure AD B2C 的功能?

  • 密码重置策略/用户流程适用于 AAD B2C 用户。您可以直接使用它。AAD B2C 用户可以使用它自己重置密码。它也是一种SSPR。

  • Azure Active Directory 自助服务密码重置。通常,它是针对企业用户的。由于此功能只是为V1登录用户流量,我不建议你用这种方式。

  • 用户配置文件上的重置密码按钮。它仅适用于 AAD(组织/企业)用户。不要为 AAD B2C 用户使用此按钮。

为什么下面的方法 3 似乎不起作用?

正如我在上面提到的,此功能仅适用于 Azure AD 用户。不是 AAD B2C 用户。因此,您不能在此处重置 B2C 用户的密码。

正如 Alex 所说,AAD B2C 用户不是 Azure AD 用户。B2C 用户适用于 2c 场景。普通 Azure AD 用户适用于组织/企业方案。

您还可以参考我对Azure AD B2C 租户和普通 Azure AD 租户有什么区别的回答


有关 B2C 密码重置策略如何工作的更多信息:

  • 单击注册/登录策略中的“忘记密码”按钮后,AAD B2C 将向应用程序发送一条带有“AADB2C90118”的消息。

  • 例如,在 ASP.NET MVC Web App 中,那么它应该挑战

private Task OnAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
            {
            notification.HandleResponse();
            // Handle the error code that Azure AD B2C throws when trying to reset a password from the login page 
            // because password reset is not supported by a "sign-up or sign-in policy"
            if (notification.ProtocolMessage.ErrorDescription != null && notification.ProtocolMessage.ErrorDescription.Contains("AADB2C90118"))
            {
                // If the user clicked the reset password link, redirect to the reset password route
                notification.Response.Redirect("/Account/ResetPassword");
            }
Run Code Online (Sandbox Code Playgroud)
  • 这意味着应用程序将/Account/ResetPassword在收到此消息后将其重定向到。

  • /Account/ResetPassword在这里从帐户控制器定义。它应该由您定义的密码重置策略名称确定。

    public void ResetPassword()
            {
                // Let the middleware know you are trying to use the reset password policy (see OnRedirectToIdentityProvider in Startup.Auth.cs)
                HttpContext.GetOwinContext().Set("Policy", Startup.ResetPasswordPolicyId);

                // Set the page to redirect to after changing passwords
                var authenticationProperties = new AuthenticationProperties { RedirectUri = "/" };
                HttpContext.GetOwinContext().Authentication.Challenge(authenticationProperties);

                return;
            }
Run Code Online (Sandbox Code Playgroud)
  • 然后用户将被重定向到 B2C 密码重置策略以更改他的密码。

  • 很有帮助谢谢。关于“为您的客户设置自助服务密码重置”一文。它对于 V1 登录用户流程*仅*是准确的。这将显示“无法访问您的帐户?”,并指向 https://passwordreset.microsoftonline.com。我测试的所有其他策略都进入 B2C 密码重置流程。 (2认同)
  • 是的 - 使用 V2 登录流程。这使用 B2C 重置密码,您可以自定义页面。 (2认同)