简体   繁体   English

Azure Active Directory注册重定向以登录

[英]Azure Active Directory Sign Up Redirects to Sign In

I am creating a website using ASP.Net Core, and securing it with Azure AD B2C. 我正在使用ASP.Net Core创建一个网站,并使用Azure AD B2C保护它。

I have already implemented signing in and it is all working fine, but now I am attempting to setup sign up and it doesn't seem to be working. 我已经实现了登录,并且一切正常,但是现在我尝试设置注册,但似乎无法正常工作。

My website setup is based on this sample . 我的网站设置基于此示例

In that example they do not use a sign up policy as they use a shared signup and signin policy (which I would prefer not to), but they do use an edit profile and reset password policy, the API methods can be seen on the SessionController . 在该示例中,他们不使用注册策略,因为他们使用共享的注册和登录策略(我不希望这样做),但是他们确实使用了编辑配置文件和重置密码策略,因此可以在SessionController上看到API方法。

I am trying to implement my signup endpoint in the same way like so: 我试图以相同的方式实现我的注册端点:

var properties = new AuthenticationProperties() { RedirectUri = "/" };
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = AzureAdB2COptions.SignUpPolicyId;
await HttpContext.Authentication.ChallengeAsync( OpenIdConnectDefaults.AuthenticationScheme, properties, ChallengeBehavior.Unauthorized);

However, when I go here I simply get redirected to the sign in page instead of the sign up page. 但是,当我去这里时,我只是被重定向到登录页面而不是注册页面。

The sign up policy and the B2C directory in general is setup correctly as I am using it on another site with no issues. 通常,正确设置了注册策略和B2C目录,因为我正在其他站点上正常使用它,没有任何问题。

Can anyone advise what may be causing this? 谁能告诉我这可能是什么原因?

In my OnRedirectToIdentityProvider method I had: 在我的OnRedirectToIdentityProvider方法中,我有:

context.ProtocolMessage.IssuerAddress = context.ProtocolMessage.IssuerAddress.Replace(defaultPolicy, policy);

As the IssuerAddress here is lower case it wasnt finding and changing the policy. 由于此处的IssuerAddress为小写字母,因此未找到并更改策略。

I updated it to: 我将其更新为:

context.ProtocolMessage.IssuerAddress = context.ProtocolMessage.IssuerAddress.ToLower().Replace(defaultPolicy.ToLower(), policy.ToLower());

As is in the latest version of the sample 与该示例最新版本一样

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Active Directory使用Microsoft帐户登录 - Azure Active Directory sign in with Microsoft Account 从Azure Active Directory向组织用户注册Power BI服务 - Sign up for Power BI Service with organizational user from Azure Active Directory 使用活动目录的MVC 5身份验证,没有单一登录 - MVC 5 authentication using active directory with no single sign on 与Active Directory集成的.NET应用程序的单点登录 - Single sign on for .NET application integrated with Active Directory MVC到Azure Active Directory签署回复“错误请求”和消息“无法创建以从中获取配置” - MVC to Azure Active Directory sign on replying with “Bad Request” and message with “Unable to create to obtain configuration from” 当在 Blazor 应用程序中使用 Azure Active Directory 时如何在 asp net core 3.1 中自定义注销页面 - How to customize sign out page in asp net core 3.1 when Azure Active Directory used in a Blazor application .NET 6 web 应用程序使用 Microsoft 标识(又名:Azure Active Directory)登录错误 - SIgn-in error in .NET 6 web application using Microsoft Identity (aka: Azure Active Directory) 在 Azure Active Directory B2C 中使用 OpenID Connect 进行 Web 登录会提供 id_token 而不是 access_token - Web sign-in with OpenID Connect in Azure Active Directory B2C gives id_token instead of access_token 如何查询名称中包含美元符号($)的用户的Active Directory? - How to query Active Directory for a user whose name contains a dollar sign ($)? 如何由活动目录中的任何用户登录(无密码) - How to sign in by any user in active directory(without password)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM