public TokenHandleStore(IMongoDatabase db, 
     StoreSettings settings, 
     IClientStore clientStore) 
     : base(db, settings.TokenHandleCollection)
 {
     _serializer = new TokenSerializer(clientStore);
 }
 public PersistenceTestFixture()
 {
     _settings = StoreSettings.DefaultSettings();
     _settings.Database = "testidentityserver";
     var registrations = new ServiceFactory(null, _settings);
     var client = new MongoClient(_settings.ConnectionString);
     _database = client.GetDatabase(_settings.Database);
     _factory = new Factory(registrations);
 }
        static async Task SetupDatabase(StoreSettings settings)
        {
            //This setup script should really be run as a job during deployment and is
            //only here to illustrate how the database can be setup from code
            var adminService = AdminServiceFactory.Create(settings);
            await adminService.CreateDatabase();
            foreach (var client in Clients.Get())
            {
                await adminService.Save(client);
            }

            foreach (var scope in Scopes.Get())
            {
                await adminService.Save(scope);
            }
        }
        public ServiceFactory(Registration<IUserService> userService,
            StoreSettings storeSettings)
        {
            var client = new MongoClient(MongoClientSettings(storeSettings.ConnectionString));
            IMongoDatabase db = client.GetDatabase(storeSettings.Database);
            Register(new Registration<IMongoDatabase>(db));
            Register(new Registration<StoreSettings>(storeSettings));
            UserService = userService;
            ClientStore = new Registration<IClientStore>(typeof(ClientStore));
            ScopeStore = new Registration<IScopeStore>(typeof(ScopeStore));
            ConsentStore = new Registration<IConsentStore>(typeof (ConsentStore));
            
            AuthorizationCodeStore = new Registration<IAuthorizationCodeStore>(typeof(AuthorizationCodeStore));

            RefreshTokenStore = new Registration<IRefreshTokenStore>(typeof (RefreshTokenStore));
            TokenHandleStore = new Registration<ITokenHandleStore>(typeof (TokenHandleStore));
            Register(new Registration<ClientSerializer>(typeof(ClientSerializer)));
        }
        public ServiceFactory(Registration <IUserService> userService,
                              StoreSettings storeSettings)
        {
            var            client = new MongoClient(MongoClientSettings(storeSettings.ConnectionString));
            IMongoDatabase db     = client.GetDatabase(storeSettings.Database);

            Register(new Registration <IMongoDatabase>(db));
            Register(new Registration <StoreSettings>(storeSettings));
            UserService  = userService;
            ClientStore  = new Registration <IClientStore>(typeof(ClientStore));
            ScopeStore   = new Registration <IScopeStore>(typeof(ScopeStore));
            ConsentStore = new Registration <IConsentStore>(typeof(ConsentStore));

            AuthorizationCodeStore = new Registration <IAuthorizationCodeStore>(typeof(AuthorizationCodeStore));

            RefreshTokenStore = new Registration <IRefreshTokenStore>(typeof(RefreshTokenStore));
            TokenHandleStore  = new Registration <ITokenHandleStore>(typeof(TokenHandleStore));
            Register(new Registration <ClientSerializer>(typeof(ClientSerializer)));
        }
예제 #6
0
 public ScopeStore(IMongoDatabase db, StoreSettings settings) :
     base(db, settings.ScopeCollection)
 {
     _serializer = new ScopeSerializer();
 }
 public ScopeStore(IMongoDatabase db, StoreSettings settings) :
     base(db, settings.ScopeCollection)
 {
     _serializer = new ScopeSerializer();
 }
예제 #8
0
 public ClientStore(IMongoDatabase db, StoreSettings settings, ClientSerializer serializer) :
     base(db, settings.ClientCollection)
 {
     _serializer = serializer;
 }
 public RefreshTokenStore(IMongoDatabase db, StoreSettings settings, IClientStore clientStore) : base(db, settings.RefreshTokenCollection)
 {
     _serializer = new RefreshTokenSerializer(clientStore);
 }
 public AuthorizationCodeStore(IMongoDatabase db, StoreSettings settings, IClientStore clientStore, IScopeStore scopeStore)
     : base(db, settings.AuthorizationCodeCollection)
 {
     _serializer = new AuthorizationCodeSerializer(clientStore, scopeStore);
 }
 public ServiceFactory(Registration <IUserService> userService)
     : this(userService, StoreSettings.DefaultSettings())
 {
 }
 public ConsentStore(IMongoDatabase db, StoreSettings settings) :
     base(db, settings.ConsentCollection)
 {
     _serializer = new ConsentSerializer();
 }
 public AuthorizationCodeStore(IMongoDatabase db, StoreSettings settings, IClientStore clientStore, IScopeStore scopeStore)
     : base(db, settings.AuthorizationCodeCollection)
 {
     _serializer = new AuthorizationCodeSerializer(clientStore, scopeStore);
 }
 public ClientStore(IMongoDatabase db, StoreSettings settings, ClientSerializer serializer) :
     base(db, settings.ClientCollection)
 {
     _serializer = serializer;
 }
 public ConsentStore(IMongoDatabase db, StoreSettings settings) :
     base(db, settings.ConsentCollection)
 {
     _serializer = new ConsentSerializer();
 }
 public RefreshTokenStore(IMongoDatabase db, StoreSettings settings, IClientStore clientStore) : base(db, settings.RefreshTokenCollection)
 {
     _serializer = new RefreshTokenSerializer(clientStore);
 }