diff --git a/samples/Mvc.Client/Startup.cs b/samples/Mvc.Client/Startup.cs index 02206b22..668d2f09 100644 --- a/samples/Mvc.Client/Startup.cs +++ b/samples/Mvc.Client/Startup.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; using System.Net.Http; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.OpenIdConnect; @@ -45,6 +47,15 @@ namespace Mvc.Client options.Scope.Add("email"); options.Scope.Add("roles"); options.Scope.Add("offline_access"); + + options.SecurityTokenValidator = new JwtSecurityTokenHandler + { + // Disable the built-in JWT claims mapping feature. + InboundClaimTypeMap = new Dictionary() + }; + + options.TokenValidationParameters.NameClaimType = "name"; + options.TokenValidationParameters.RoleClaimType = "role"; }); services.AddMvc();