public async Task<IActionResult> SignOutAsync(string redirectUrl = null)
{
var userObjectIdentifier = _httpContext.User.GetObjectIdentifierValue();
var issuer = _httpContext.User.GetTenantIdValue();
try
{
_logger.SignoutStarted(userObjectIdentifier, issuer);
await _httpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
await _httpContext.Authentication.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme,
new AuthenticationProperties { RedirectUri = redirectUrl });
_logger.SignoutCompleted(userObjectIdentifier, issuer);
}
catch (Exception exp)
{
_logger.SignoutFailed(userObjectIdentifier, issuer, exp);
return new HttpStatusCodeResult((int)HttpStatusCode.InternalServerError);
}
return new EmptyResult();
}
}