Browse Source

Disable the built-in OIDC claims mapping feature in the MVC sample

pull/466/head
Kévin Chalet 9 years ago
parent
commit
ae54086ae9
  1. 11
      samples/Mvc.Client/Startup.cs

11
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<string, string>()
};
options.TokenValidationParameters.NameClaimType = "name";
options.TokenValidationParameters.RoleClaimType = "role";
});
services.AddMvc();

Loading…
Cancel
Save