AI OnAI Off
Configuring the CookieAuthenticationOptions.LogoutPath should do it. Do you mind posting your whole configuration in startup.cs? Maybe something else is configuring the options.
Found this soltuion, using MapWhen (this will stop execution of other midlewares) instead of only Map.
app.MapWhen(ctx => ctx.Request.Path.StartsWithSegments("/Util/Logout"), appBuilder =>
{
appBuilder.Run(async appBuilder =>
{
await appBuilder.SignOutAsync();
appBuilder.Response.Redirect("/", false);
});
});
INFO: I do not use EPiServer.CMS.UI.AspNetIdentity, but Azure AD SSO.
In Optimizely we have an Logout link inside /episerver/cms. It point to /Util/Logout. I want my users to logout using this feature. Now they get an 500 error page if they use it. InvalidOperationException: Unable to resolve service for type 'EPiServer.Shell.Security.UISignInManager' while attempting to activate 'EPiServer.Cms.Shell.UI.Controllers.Internal.AccountController'.
I feel like I have two options. Either to hijack the request to /Util/Logout and run my own logout logic or to change the url. Both solutions should be possible, but I can't get it to work.
In cms 11 it was possible to hijack the request like this
I tried to do this in cms 12 but with no luck:
A different approach is to change the url, to point to an url I control.
The logout link is generated inside a [MenuProvider] inside EPiServer.Cms.Shell.UI.Internal.CmsMenuProvider. On line 3 below it seams that it should be possible to change the url by setting the CookieAuthenticationOptions.LogoutPath.
I tried this in my Startup.cs
But with no luck. When / how should I set the LogoutPath to make this work?