其他分享
首页 > 其他分享> > 获得identity Server4当前用户的角色

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

 

标签:36000,false,角色,StandardScopes,Server4,ClientId,IdentityServerConstants,ClientNam
来源: https://www.cnblogs.com/wjx-blog/p/14730095.html