获得identity Server4当前用户的角色
服务器端配置:
Client oneResult = new Client { ClientId = client.ClientId, ClientName = client.ClientName, AllowedGrantTypes = GrantTypes.ResourceOwnerPassword, ClientSecrets = { new Secret("111111".Sha256()) }, AllowOfflineAccess = true, RequireConsent = false, RequireClientSecret = false, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.OfflineAccess, "role" }, AuthorizationCodeLifetime = 36000, IdentityTokenLifetime = 36000, UserSsoLifetime = 36000 };
API地址:
http://localhost:5000/connect/userinfo
postman调用截图: