Reputation: 6579
I was wondering if somebody can explain to me what AddInMemoryIdentityResources
is used for when registering identity server during startup. From the examples they have shown it looks like this (note the code between comments):
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddInMemoryPersistedGrants()
//********************
.AddInMemoryIdentityResources(Config.GetIdentityResources())
//********************
.AddInMemoryApiResources(configurationManager.GetApiResources())
.AddInMemoryClients(configurationManager.GetClients())
.AddAspNetIdentity<User>();
Then the config file is something like this:
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
};
}
Now, I thought that when you declare a client you define the scopes which basically say you are allowed to pass username, id, etc... However, then what is the point of this statement .AddInMemoryIdentityResources(Config.GetIdentityResources())
as it seems to do the same thing but yet its global as it doesn't tie to any client?
Upvotes: 2
Views: 2509
Reputation: 5264
AddInMemoryIdentityResources is basically defining the global list of available identity scopes. I.e. the master list which clients can then reference.
Upvotes: 6