asp.netcore openIDConnect ID_Token FrontChannellogout

问题描述 投票:0回答:0

I正在使用

Microsoft.AspNetCore.Authentication.OpenIdConnect
.NET 8库进行本地AD FS(应用程序组 / NativeClientApplication)的身份验证。 因此,到目前为止,直接从应用程序起作用的身份验证和注销无济于事。

我在前频道注册处有问题:

https://openid.net/specs/openid-connect-frontchannel-1_0.html#rfc.section.3.1

因此,我在我的OAuth应用程序“ A”中登录,然后切换到另一个应用程序“ B”,而无需再次登录,因为SSO。在应用程序“ B”中登录时,ADF开始拨打清理呼叫,以供所有授予SSO的应用程序。 I还可以查看ADF的请求到我的应用A。之后,我再次在ADF的符号上,

tbut

直接导航到应用程序A时,我仍然登录我,因为应用程序A中的Cookie是未终止前通道过程(我还检查了cookie的框场设置是否存在问题,这里没有问题)。

登录信号从ADF到应用程序A:

和回调: FrontChannelLogout

工作直接注销看起来像这样: Callbackawait HttpContext.SignOutAsync( OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties { RedirectUri = new Uri($"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() } );

这是我的配置设置:

builder.Services.AddAuthentication(configureOptions => { configureOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; configureOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; }).AddCookie(configureOptions => { configureOptions.SlidingExpiration = true; }).AddOpenIdConnect(configureOptions => { configureOptions.SaveTokens = true; configureOptions.MetadataAddress = "https://my.idp.com/adfs/.well-known/openid-configuration"; configureOptions.ResponseType = OpenIdConnectResponseType.IdToken; configureOptions.SignOutScheme = OpenIdConnectDefaults.AuthenticationScheme; configureOptions.Scope.Clear(); configureOptions.Scope.Add("openid"); configureOptions.CallbackPath = "/signin-oidc"; configureOptions.RemoteSignOutPath = "/signout-oidc"; configureOptions.SignedOutCallbackPath = "/signout-callback-oidc"; configureOptions.ClientId = "https://example.com/applications/oauthpassive/"; });
I在类中创建了一个功能断点

HandleRemoteSignOutAsync

https://github.com/dotnet/aspnetcore/blob/main/src/security/authentication/openidconnect/src/openidconnectler.cs,
因此,当IDP的前频道注销是触发时,我也可以在网络面板中看到请求正在待处理,因为断点:

当调试时,我看到该代码已执行,并且没有闯入:

不过,用户仍在应用程序中登录。 有什么想法我可以配置,开发或调查什么? Break in callback工作室

在进行更多调查后,我发现在收到前频道注销时可以摆脱身份验证饼干的解决方法:

OpenIdConnectHandlerDebug 当时想知道是否有用于此类签名的内置解决方案。

是因为您配置了

configureOptions.Events = new OpenIdConnectEvents { OnRemoteSignOut = async context => { await context.HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); } };

不是您使用的方案(即设置cookie)

AddOpenIdConnect()
。
so删除此配置,您不需要解决方法。
    

c# asp.net-core oauth-2.0 openid-connect asp.net-core-identity
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.