public static IdentityServerServiceFactory Configure(string connString)
        {
            var efConfig = new EntityFrameworkServiceOptions
            {
                ConnectionString = connString,
            };

            // these two calls just pre-populate the test DB from the in-memory config
            ConfigureClients(Clients.Get(), efConfig);
            ConfigureScopes(Scopes.Get(), efConfig);

            var factory = new IdentityServerServiceFactory();

            factory.RegisterConfigurationServices(efConfig);
            factory.RegisterOperationalServices(efConfig);

            factory.UseInMemoryUsers(Users.Get());

            return(factory);
        }
Esempio n. 2
0
        public static IdentityServerServiceFactory Configure(string connString)
        {
            var efConfig = new EntityFrameworkServiceOptions {
                ConnectionString = connString,
                //Schema = "foo"
            };

            // these two calls just pre-populate the test DB from the in-memory config
            ConfigureClients(Clients.Get(), efConfig);
            ConfigureScopes(Scopes.Get(), efConfig);

            var factory = new IdentityServerServiceFactory();

            factory.RegisterConfigurationServices(efConfig);
            factory.RegisterOperationalServices(efConfig);

            var userService = new Thinktecture.IdentityServer.Core.Services.InMemory.InMemoryUserService(Users.Get());

            factory.UserService = new Registration <IUserService>(resolver => userService);

            return(factory);
        }
        public static IdentityServerServiceFactory Configure(string connString)
        {
            var svcFactory = new ServiceFactory(connString);

            svcFactory.ConfigureClients(Clients.Get());
            svcFactory.ConfigureScopes(Scopes.Get());

            var factory = new IdentityServerServiceFactory();

            var userService = new Thinktecture.IdentityServer.Core.Services.InMemory.InMemoryUserService(Users.Get());

            factory.UserService = Registration.RegisterFactory <IUserService>(() => userService);

            factory.ScopeStore  = Registration.RegisterFactory <IScopeStore>(() => svcFactory.CreateScopeStore());
            factory.ClientStore = Registration.RegisterFactory <IClientStore>(() => svcFactory.CreateClientStore());

            factory.AuthorizationCodeStore = Registration.RegisterFactory <IAuthorizationCodeStore>(() => svcFactory.CreateAuthorizationCodeStore());
            factory.TokenHandleStore       = Registration.RegisterFactory <ITokenHandleStore>(() => svcFactory.CreateTokenHandleStore());
            factory.ConsentStore           = Registration.RegisterFactory <IConsentStore>(() => svcFactory.CreateConsentStore());
            factory.RefreshTokenStore      = Registration.RegisterFactory <IRefreshTokenStore>(() => svcFactory.CreateRefreshTokenStore());

            return(factory);
        }