我希望我的应用程序接受来自两个不同B2C用户流的签名,使用相同的租户和应用程序注册。换句话说,我希望这两个链接都允许我登录到我的应用程序。
我从Visual模板开始,使用Microsoft平台作为身份验证类型(尽管基本的剃刀应用程序也有相同的问题),并简单地更改了应用程序设置以放置B2C信息。
"AzureAdB2C": {
"Instance": "https://myapp.b2clogin.com",
"ClientId": "00000000-0000-0000-0000-000000000000", //my client id
"Domain": "myapp.onmicrosoft.com",
"SignUpSignInPolicyId": "b2c_1_susi",
"TenantId": "11111111-0000-0000-0000-000000000000" //my tenant id
},
"AzureAdB2CVIP": {
"Instance": "https://myapp.b2clogin.com",
"ClientId": "00000000-0000-0000-0000-000000000000", //my client id, same as AzureAdB2C
"Domain": "myapp.onmicrosoft.com",
"SignUpSignInPolicyId": "b2c_1_susi_vip",
"TenantId": "11111111-0000-0000-0000-000000000000" //my tenant id
}然后在Startup.cs in ConfigureServices中,我更改了设置名:
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAdB2C"));
services.AddControllersWithViews()
.AddMicrosoftIdentityUI();正如预期的那样,当我运行我的应用程序时,我会被重定向到我的b2c_1_susi策略来登录,并且它连接得很好。
现在我想添加b2c_1_susi_vip。它不需要是默认的,但我的应用程序也应该接受它。在尝试了我发现的几种方法之后,我得到的最不坏的方法如下:
var auth = services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme);
auth.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAdB2CVIP"));
auth.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAdB2C"), cookieScheme: "authvip", openIdConnectScheme: "");它将我重定向到b2c_1_susi,并且至少可以使用该策略,但尝试在Error from RemoteAuthentication: IDX10501: Signature validation failed中登录b2c_1_susi_vip结果。
我几乎总是以签名错误或message.State为空/无法读取的错误结束。
我尝试过的方法都没有成功
这种看似简单的场景不可能吗?
发布于 2022-07-26 19:27:40
我永远无法让我的用户流和我的自定义策略一起工作,所以我将我的用户流重新创建为一个自定义策略。然后,我使用this answer作为解决方案的起点。
我创建了一个带有properties.Items["policy"] = "b2c_1_susi_vip";
https://stackoverflow.com/questions/72960223
复制相似问题