Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Registering Transient Stores #16

@ChristianRiedl

Description

@ChristianRiedl

I am working with idsrv4 using your EF persistence 👍 .
I see this potential problem :

Idsrv4, inside AddIdentityServer always registers the InMemory transient stores
public static IServiceCollection AddInMemoryTransientStores(this IServiceCollection services) { services.TryAddSingleton<IAuthorizationCodeStore, InMemoryAuthorizationCodeStore>(); services.TryAddSingleton<IRefreshTokenStore, InMemoryRefreshTokenStore>(); services.TryAddSingleton<ITokenHandleStore, InMemoryTokenHandleStore>(); services.TryAddSingleton<IConsentStore, InMemoryConsentStore>(); return services; }

Then your code registers the EF based stores :

public EntityFrameworkOptions RegisterOperationalStores<TOperationalContext>() { _builder.Services.AddScoped<OperationalContext, TOperationalContext>(); _builder.Services.AddScoped<IAuthorizationCodeStore, AuthorizationCodeStore>(); _builder.Services.AddScoped<ITokenHandleStore, TokenHandleStore>(); _builder.Services.AddScoped<IConsentStore, ConsentStore>(); _builder.Services.AddScoped<IRefreshTokenStore, RefreshTokenStore>(); return this; }

So this stores are registered twice, once a singleton once in scoped mode. I am not sure what happens if the same Interface is registered twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions