|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.IdentityModel.Tokens.Jwt; |
|
|
using System.Net.Http; |
|
|
using System.Net.Http; |
|
|
using Microsoft.AspNetCore.Authentication.Cookies; |
|
|
using Microsoft.AspNetCore.Authentication.Cookies; |
|
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect; |
|
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect; |
|
|
@ -45,6 +47,15 @@ namespace Mvc.Client |
|
|
options.Scope.Add("email"); |
|
|
options.Scope.Add("email"); |
|
|
options.Scope.Add("roles"); |
|
|
options.Scope.Add("roles"); |
|
|
options.Scope.Add("offline_access"); |
|
|
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(); |
|
|
services.AddMvc(); |
|
|
|