【发布时间】:2021-03-20 18:39:14
【问题描述】:
- xyz.com
- yzx.com
- zxy.com
我有这些域,并且正在运行具有 AuthO Openid 连接的身份服务器 4 应用程序。我的主域是xyz.com,所以如果用户使用yzx.com等其他域登录,只有在AuthO成功登录后才会重定向到我的主域回调路径。因为我只在所有正在运行的域中注册了我的主域的回调路径。
请看下面的例子:
var primaryBrandOpenIdRedirectURL = SharedResourceConstants.HyperText + primaryBrandHostUrl + pathBase.GetPathBase(HttpContext) + sso.RedirectPath;
var openIdOptions = new OpenIdConnectOptions
{
ClientId = rijndaelEncryption.Decrypt(sso.ClientId),
ClientSecret = rijndaelEncryption.Decrypt(sso.ClientSecret),
Authority = sso.Authority,
SignInScheme =
IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme,
ForwardSignOut = sso.ForwardSignOut,
// Call back path should be unique.
CallbackPath = new PathString(sso.RedirectPath),
};
if (!organization.IsDefaultBrand)
{
openIdOptions.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = ctx =>
{
ctx.ProtocolMessage.RedirectUri = primaryBrandOpenIdRedirectURL;
return Task.FromResult(0);
}
};
}
这在两个不同的本地主机端口中工作正常,但在暂存时面临以下问题。
System.Exception: 处理远程登录时遇到错误。
System.Exception:关联失败。
在 Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d__12.MoveNext() 偏移 1286
在偏移量 17 处的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task 任务) 偏移 39
在偏移量 46 处的 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task 任务)
在 IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.d__6.MoveNext() 偏移 437
在偏移量 17 处的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task 任务) 偏移 39
在 Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext() 偏移 953
在偏移量 17 处的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task 任务) 偏移 39
在偏移量 46 处的 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task 任务) ```
【问题讨论】:
-
你在本地使用HTTPS吗?分期呢?
-
是的,我只使用localhost:44339 和example.com 一样的分期
标签: c# asp.net-core identityserver4 openid-connect identityserver3