Sigurd Garshol
Sigurd Garshol

Reputation: 1544

IdentityServer4, IResourceStore.GetAllResources()

I am looking at building a class implementing the IdentityServer IResourceStore interface. My goal is to serve IdentityResource and ApiResource collections as defined in a custom repository.

Ideally, I will receive requests for these resources and respond with the subset relevant to the query. In short: You only get what you ask for.

The GetAllResources()method makes me leery: Is IdentityServer actually requiring that I pull the entire set of my Identity and API resources from my repository and make this available? At this point I have no idea how large those collections will grow, or the cost of pulling them from the repository.

What are the consequences of simply responding with a null or empty lists of resources?

-S

Upvotes: 2

Views: 1253

Answers (1)

Scott Brady
Scott Brady

Reputation: 5598

It's used in the GetAllEnabledResourcesAsync method in the IResourceStoreExtensions class, which in turn is used by the DiscoveryEndpoint. So, if you don't implement this method the Discovery endpoint will not be able to display any scopes or claims.

By don't implement I mean return some empty lists or something, not throw a NotImplementedException or return null... That would break everything.

Upvotes: 5

Related Questions