Identityserver4: No default instance for IdentityServer4.Stores.IAuthorizationParametersMessageStore

Created on 20 Aug 2019  路  8Comments  路  Source: IdentityServer/IdentityServer4

IdentityServer 2.5.2

When using StructureMap as DI (v1.4.0), receive an error for missing default instance of IdentityServer4.Stores.IAuthorizationParametersMessageStore

Can work around by creating a dummy implementation or downgrading to IdentityServer 2.4.0

Issue / Steps to reproduce the problem

Using StructureMap as DI

Relevant parts of the log file

-----------------------------------------------------------------------------------------------------
Build Error on Instance 'IdentityServer4.Services.ReturnUrlParser' 
    for PluginType IdentityServer4.Services.ReturnUrlParser
 - and Instance 'IdentityServer4.Services.DefaultIdentityServerInteractionService' for PluginType IdentityServer4.Services.IIdentityServerInteractionService

No default Instance is registered and cannot be automatically determined for type 'IdentityServer4.Stores.IAuthorizationParametersMessageStore'
There is no configuration specified for IdentityServer4.Stores.IAuthorizationParametersMessageStore


-----------------------------------------------------------------------------------------------------
Build Error on Instance 'IdentityServer4.Endpoints.AuthorizeCallbackEndpoint' 
    for PluginType IdentityServer4.Endpoints.AuthorizeCallbackEndpoint

No default Instance is registered and cannot be automatically determined for type 'IdentityServer4.Stores.IAuthorizationParametersMessageStore'
There is no configuration specified for IdentityServer4.Stores.IAuthorizationParametersMessageStore
bug report pinned wontfix

Most helpful comment

We'll add a default.

All 8 comments

If you've not configured this feature, then there's no code path that triggers the use of this service. I guess in StructureMap it's mandatory, whereas in ASP.NET Core DI that it's not.

We'll add a default.

Resolved it in my project using (in Startup.cs / ConfigureServices method)

 services.AddAuthorizationParametersMessageStore<DistributedCacheAuthorizationParametersMessageStore>()

(see https://github.com/IdentityServer/IdentityServer4/blob/master/src/IdentityServer4/src/Stores/Default/DistributedCacheAuthorizationParametersMessageStore.cs)

Think dummy implementation can be easy created from https://github.com/IdentityServer/IdentityServer4/blob/master/src/IdentityServer4/src/Stores/Default/QueryStringAuthorizationParametersMessageStore.cs

Looking at this again, we're taking advantage of the support in ASP.NET Core DI for optional ctor params and the behavior is different based on the preseance/absence of the service in DI.

PR added, but I'm not happy with it.

Since a workaround exists, not sure we need to do anything for 3.1 - and re-visit for 4.0

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings