|
|
@ -6,6 +6,8 @@ using Microsoft.eShopOnContainers.WebMVC.Services; |
|
|
|
using Microsoft.AspNetCore.Http.Authentication; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authentication; |
|
|
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect; |
|
|
|
using Microsoft.AspNetCore.Authentication.Cookies; |
|
|
|
|
|
|
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers |
|
|
|
{ |
|
|
@ -35,15 +37,16 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers |
|
|
|
return RedirectToAction(nameof(CatalogController.Index), "Catalog"); |
|
|
|
} |
|
|
|
|
|
|
|
public IActionResult Signout() |
|
|
|
public async Task<IActionResult> Signout() |
|
|
|
{ |
|
|
|
HttpContext.Authentication.SignOutAsync("Cookies"); |
|
|
|
HttpContext.Authentication.SignOutAsync("oidc"); |
|
|
|
|
|
|
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); |
|
|
|
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme); |
|
|
|
|
|
|
|
// "Catalog" because UrlHelper doesn't support nameof() for controllers
|
|
|
|
// https://github.com/aspnet/Mvc/issues/5853
|
|
|
|
var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog"); |
|
|
|
return new SignOutResult("oidc", new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl }); |
|
|
|
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme, |
|
|
|
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |