public static void RegisterOperationalServices(this IdentityServerServiceFactory factory, RavenDbServiceOptions options) { if (factory == null) throw new ArgumentNullException("factory"); if (options == null) throw new ArgumentNullException("options"); factory.Register(new Registration<IDocumentStore>(options.Store)); }
public TokenCleanup(RavenDbServiceOptions options, int interval = 60) { if (options == null) throw new ArgumentNullException("options"); if (interval < 1) throw new ArgumentException("interval must be more than 1 second"); this.options = options; this.interval = TimeSpan.FromSeconds(interval); }
public static void RegisterClientStore(this IdentityServerServiceFactory factory, RavenDbServiceOptions options) { if (factory == null) throw new ArgumentNullException("factory"); if (options == null) throw new ArgumentNullException("options"); factory.Register(new Registration<IDocumentStore>(options.Store)); factory.ClientStore = new Registration<IClientStore, ClientStore>(); factory.CorsPolicyService = new ClientConfigurationCorsPolicyRegistration(options); }
public static void RegisterConfigurationServices(this IdentityServerServiceFactory factory, RavenDbServiceOptions options) { factory.RegisterClientStore(options); factory.RegisterScopeStore(options); factory.RegisterAuthorizationCodeStore(options); factory.RegisterTokenHandleStore(options); factory.RegisterConsentStore(options); factory.RegisterRefreshTokenStore(options); }
public static void ConfigureScopes(IEnumerable<Scope> scopes, RavenDbServiceOptions options) { using (var s = options.Store.OpenSession()) { foreach (var scope in scopes) { var toSave = Identityserver.Contrib.RavenDB.Data.StoredScope.ToDbFormat(scope); s.Store(toSave); } s.SaveChanges(); } }
public static void ConfigureClients(IEnumerable<Client> clients, RavenDbServiceOptions options) { using (var s = options.Store.OpenSession()) { foreach (var client in clients) { var toSave = Identityserver.Contrib.RavenDB.Data.StoredClient.ToDbFormat(client); s.Store(toSave); } s.SaveChanges(); } }
public static IdentityServerServiceFactory Configure() { _ravenConfig = new RavenDbServiceOptions("Raven"); var cleanup = new TokenCleanup(_ravenConfig, 30); cleanup.Start(); // these two calls just pre-populate the test DB from the in-memory config ConfigureClients(Clients.Get(), _ravenConfig); ConfigureScopes(Scopes.Get(), _ravenConfig); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(_ravenConfig); factory.RegisterOperationalServices(_ravenConfig); factory.UseInMemoryUsers(Users.Get()); return factory; }
public static void RegisterAuthorizationCodeStore(this IdentityServerServiceFactory factory, RavenDbServiceOptions options) { if (factory == null) throw new ArgumentNullException("factory"); if (options == null) throw new ArgumentNullException("options"); factory.Register(new Registration<IDocumentStore>(options.Store)); factory.AuthorizationCodeStore = new Registration<IAuthorizationCodeStore, AuthorizationCodeStore>(); }