簡體   English   中英

Azure Active Directory注冊重定向以登錄

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

我正在使用ASP.Net Core創建一個網站,並使用Azure AD B2C保護它。

我已經實現了登錄,並且一切正常,但是現在我嘗試設置注冊,但似乎無法正常工作。

我的網站設置基於此示例

在該示例中,他們不使用注冊策略,因為他們使用共享的注冊和登錄策略(我不希望這樣做),但是他們確實使用了編輯配置文件和重置密碼策略,因此可以在SessionController上看到API方法。

我試圖以相同的方式實現我的注冊端點:

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

但是,當我去這里時,我只是被重定向到登錄頁面而不是注冊頁面。

通常,正確設置了注冊策略和B2C目錄,因為我正在其他站點上正常使用它,沒有任何問題。

誰能告訴我這可能是什么原因?

在我的OnRedirectToIdentityProvider方法中,我有:

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

由於此處的IssuerAddress為小寫字母,因此未找到並更改策略。

我將其更新為:

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

與該示例最新版本一樣

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM