-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Is your feature request related to a problem?
It looks like there there is no option to allow silent sign out of OpenID server.
Orchard Core sets pass-through mode on OpenIdDict logout handler and uses Logout() to process sign out request, which returns confirmation form unless user is already signed out of IdP.
In terms of OpenID, confirmation doesn't seem necessary as long as valid id_token_hint is provided (which is ensured in pass-through mode).
Describe the solution you'd like
Sign out without confirmation unless id_token_hint is invalid.
Update: Add a checkbox to the OpenID server configuration to allow disabling end-user confirmation for RP-initiated logout.
Describe alternatives you've considered
A potential way to make silent sign out work is to disable the pass-through mode on logout request, and let OpenIdDict handle it. One could
disable the pass-through mode on logout request
builder.Services.PostConfigureAll<OpenIddictServerAspNetCoreOptions>(options =>
{
options.EnableLogoutEndpointPassthrough = false;
});and use a custom logout event handler that would trigger the sign out
public class CustomLogoutRequestHandler : IOpenIddictServerHandler<OpenIddictServerEvents.HandleLogoutRequestContext>
{
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.HandleLogoutRequestContext>()
.UseSingletonHandler<CustomLogoutRequestHandler>()
.SetOrder(int.MinValue)
.SetType(OpenIddictServerHandlerType.Custom)
.Build();
public ValueTask HandleAsync(OpenIddictServerEvents.HandleLogoutRequestContext context)
{
// Trigger silent sign-out
context.SignOut();
return default;
}
}
builder.Services.PostConfigureAll<OpenIddictServerBuilder>(options =>
{
options.AddEventHandler(CustomLogoutRequestHandler.Descriptor);
});