For this to work properly you need to configure an IAuthenticationSessionStore provider.
The Tcg.Owin.Cookies.SessionStore project has 2 implementations available:
- Tcg.Owin.Cookies.SessionStore.Memory
- Tcg.Owin.Cookies.SessionStore.Redis
Install-Package Tcg.Owin.Security.OpenIdConnect
app.UseTcgOpenIdConnectAuthentication(new TcgOpenIdConnectAuthenticationOptions
{
ClientId = <clientId>,
ClientSecret = <clientSecret>,
ResponseType = "id_token token",
Authority = <authority>,
Scope = <required scopes>,
RedirectUri = <redirect url>,
PostLogoutRedirectUri = <post logout redirect url>,
SessionStore = new RedisAuthenticationSessionStore(<redis connection string>)
// or
SessionStore = new MemoryAuthenticationSessionStore()
});
public ActionResult LogOff()
{
//Log out of the Owin Midleware
Request.GetOwinContext().Authentication.SignOut();
//Abandon the MVC Sessions
HttpContext.Session.Abandon();
return new EmptyResult();
}
The Request.GetOwinContext().Authentication.SignOut();
triggers the RedirectToIdentityProvider in TcgOpenIdConnectExtensions with ProtocolMessage.RequestType == OpenIdConnectRequestType.Logout
tenant
- the portalIdentifier of the academy portalexternalCss
- to load external CSS