|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
using IdentityModel;
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
@ -5,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
|
|
|
|
using Yavsc;
|
|
|
|
|
|
|
|
|
|
|
|
public class Startup
|
|
|
|
public class Startup
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -34,12 +36,11 @@ public class Startup
|
|
|
|
options.GetClaimsFromUserInfoEndpoint = true;
|
|
|
|
options.GetClaimsFromUserInfoEndpoint = true;
|
|
|
|
options.SaveTokens = true;
|
|
|
|
options.SaveTokens = true;
|
|
|
|
options.ClaimActions.MapUniqueJsonKey(
|
|
|
|
options.ClaimActions.MapUniqueJsonKey(
|
|
|
|
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role",
|
|
|
|
Constants.RoleClaimName,
|
|
|
|
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
|
|
Constants.RoleClaimName);
|
|
|
|
options.ClaimActions.MapUniqueJsonKey("role",
|
|
|
|
options.ClaimActions.MapUniqueJsonKey(
|
|
|
|
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
|
|
JwtClaimTypes.Scope,
|
|
|
|
options.ClaimActions.MapUniqueJsonKey("roles",
|
|
|
|
JwtClaimTypes.Scope);
|
|
|
|
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
|
|
|
|
|
|
|
|
options.TokenValidationParameters = new TokenValidationParameters
|
|
|
|
options.TokenValidationParameters = new TokenValidationParameters
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NameClaimType = "name",
|
|
|
|
NameClaimType = "name",
|
|
|
|
|