Identity Resource
身份资源,里面的UserClaims是用户的一些属性,默认情况下,即使写再多的属性,token中也只会返回sub一个,我们需要在代码中加入
var builder = services.AddIdentityServer()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.Apis)
.AddInMemoryClients(Config.Clients)
.AddTestUsers(TestUsers.Users)
.AddProfileService<ProfileService>();
// not recommended for production - you need to store your key material somewhere secure
builder.AddDeveloperSigningCredential();
然后去实现IProfileService
public class ProfileService : IProfileService
{
protected readonly TestUserStore Users;
public ProfileService(TestUserStore users)
{
Users = users;
}