Changes for retrieving all claims under netcore2
This commit is contained in:
parent
d9b9578e48
commit
2e64a97b4c
@ -96,6 +96,7 @@ namespace Identity.API.Configuration
|
||||
AllowAccessTokensViaBrowser = false,
|
||||
RequireConsent = false,
|
||||
AllowOfflineAccess = true,
|
||||
AlwaysIncludeUserClaimsInIdToken = true,
|
||||
RedirectUris = new List<string>
|
||||
{
|
||||
$"{clientsUrl["Mvc"]}/signin-oidc"
|
||||
|
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
||||
options.Scope.Add("orders");
|
||||
options.Scope.Add("basket");
|
||||
options.Scope.Add("marketing");
|
||||
options.Scope.Add("locations");
|
||||
});
|
||||
|
||||
services.AddAuthentication(options => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user