Skip to content

Commit 2e64a97

Browse files
committed
Changes for retrieving all claims under netcore2
1 parent d9b9578 commit 2e64a97

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/Services/Identity/Identity.API/Configuration/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public static IEnumerable<Client> GetClients(Dictionary<string,string> clientsUr
9696
AllowAccessTokensViaBrowser = false,
9797
RequireConsent = false,
9898
AllowOfflineAccess = true,
99+
AlwaysIncludeUserClaimsInIdToken = true,
99100
RedirectUris = new List<string>
100101
{
101102
$"{clientsUrl["Mvc"]}/signin-oidc"

src/Web/WebMVC/Controllers/AccountController.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using Microsoft.AspNetCore.Http.Authentication;
77
using System.Threading.Tasks;
88
using Microsoft.AspNetCore.Authentication;
9+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
10+
using Microsoft.AspNetCore.Authentication.Cookies;
911

1012
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
1113
{
@@ -35,15 +37,16 @@ public async Task<IActionResult> SignIn(string returnUrl)
3537
return RedirectToAction(nameof(CatalogController.Index), "Catalog");
3638
}
3739

38-
public IActionResult Signout()
40+
public async Task<IActionResult> Signout()
3941
{
40-
HttpContext.Authentication.SignOutAsync("Cookies");
41-
HttpContext.Authentication.SignOutAsync("oidc");
42-
42+
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
43+
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
44+
4345
// "Catalog" because UrlHelper doesn't support nameof() for controllers
4446
// https://github.com/aspnet/Mvc/issues/5853
4547
var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog");
46-
return new SignOutResult("oidc", new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
48+
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme,
49+
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
4750
}
4851
}
4952
}

src/Web/WebMVC/Startup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void ConfigureServices(IServiceCollection services)
100100
options.Scope.Add("orders");
101101
options.Scope.Add("basket");
102102
options.Scope.Add("marketing");
103+
options.Scope.Add("locations");
103104
});
104105

105106
services.AddAuthentication(options => {

0 commit comments

Comments
 (0)