IdentityServer / IdentityServer3.EntityFramework

EntityFramework persistence layer for IdentityServer3
Apache License 2.0
68 stars 97 forks source link

RegisterConfigurationServices, RegisterOperationalServices Extentions Improvements #97

Closed BruceHunter closed 8 years ago

BruceHunter commented 8 years ago

Issue / Feature

These extensions to do not have a way to pass in IClientConfigurationDbContext, IScopeConfigurationDbContext or IOperationalDbContext.

idSvrFactory.RegisterConfigurationServices(efConfig);
idSvrFactory.RegisterOperationalServices(efConfig);

If you wanted to turn off EF Migrations for example. You would create your own ConfigurationDbContext classes and pass them in like this.

idSvrFactory.Register(new Registration<IClientConfigurationDbContext>(resolver => new ClientConfigurationDbContext()));
idSvrFactory.ClientStore = new Registration<IClientStore, ClientStore>();
idSvrFactory.CorsPolicyService = new ClientConfigurationCorsPolicyRegistration(efConfig);

idSvrFactory.Register(new Registration<IScopeConfigurationDbContext>(resolver => new ScopeConfigurationDbContext()));
idSvrFactory.ScopeStore = new Registration<IScopeStore, ScopeStore>();

idSvrFactory.Register(new Registration<IOperationalDbContext>(resolver => new OperationalDbContext()));
idSvrFactory.AuthorizationCodeStore = new Registration<IAuthorizationCodeStore, AuthorizationCodeStore>();
idSvrFactory.TokenHandleStore = new Registration<ITokenHandleStore, TokenHandleStore>();
idSvrFactory.ConsentStore = new Registration<IConsentStore, ConsentStore>();
idSvrFactory.RefreshTokenStore = new Registration<IRefreshTokenStore, RefreshTokenStore>();  

You would also have to create your own TokenCleanup class and return

        public override IdentityServer3.EntityFramework.IOperationalDbContext CreateOperationalDbContext()
        {
            return new OperationalDbContext();
        }
brockallen commented 8 years ago

Closing, sort of dup of other issue (that I can't find now).