获得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调用截图:

获得identity Server4当前用户的角色

 

上一篇:ansible-playbook一键化部署apache服务


下一篇:从Http到Https:宝塔面板申请Let‘s Encrypt的免费SSL证书