public void Configuration(IAppBuilder app) { var entityFrameworkOptions = new EntityFrameworkServiceOptions { ConnectionString = ConfigurationManager.ConnectionStrings["TimeIdentity"].ConnectionString }; var inMemo = new InMemoryManager(); SetupClients(inMemo.GetClients(), entityFrameworkOptions); SetupScopes(inMemo.GetScopes(), entityFrameworkOptions); var unitOfWork = new UnitOfWork(); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(entityFrameworkOptions); factory.RegisterOperationalServices(entityFrameworkOptions); factory.UserService = new Registration <IUserService>(typeof(TimeUserService)); factory.Register(new Registration <UnitOfWork>(unitOfWork)); var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]); var options = new IdentityServerOptions { SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]), RequireSsl = false, Factory = factory, }; app.UseIdentityServer(options); }
public static void ConfigureUsers(IEnumerable <InMemoryUser> users, EntityFrameworkServiceOptions options) { using (var db = new UserContext(options.ConnectionString)) { using (var store = new UserStore(db)) { using (var manager = new UserManager(store)) { if (!db.Users.Any()) { foreach (var u in users) { var result = manager.CreateAsync(u.ToUser(), Users.DefaultPassword).Result; if (result.Succeeded) { var user = manager.FindByNameAsync(u.Username).Result; foreach (var claim in u.Claims) { result = manager.AddClaimAsync(user.Id, claim).Result; } } } db.SaveChanges(); } } } } }
public static IdentityServerServiceFactory Configure(this IdentityServerServiceFactory factory, string connectionString) { var serviceOptions = new EntityFrameworkServiceOptions { ConnectionString = connectionString, Schema = "AuthServer".ToUpper() }; SetupScopes(InMemoryManager.GetScopes(), serviceOptions); SetupUsers(InMemoryManager.GetUsers(), serviceOptions); SetupClients(InMemoryManager.GetClients(), serviceOptions); factory.RegisterOperationalServices(serviceOptions); factory.RegisterConfigurationServices(serviceOptions); //factory.Register(new Registration<OperationsDbContext>(resolver=>new OperationsDbContext(serviceOptions.ConnectionString,serviceOptions.Schema))); factory.Register(new Registration <Context>(resolver => new Context(connectionString))); factory.Register(new Registration <UserStore>()); factory.Register(new Registration <UserManager>()); new TokenCleanup(serviceOptions, 1).Start(); var context = new Context(serviceOptions.ConnectionString); var userService = new AspNetIdentityUserService <IdentityUser, string>(new UserManager(new UserStore(context))); factory.UserService = new Registration <IUserService>(userService); return(factory); }
public static IdentityServerServiceFactory Configure(string connString) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connString, //Schema = "foo" }; var cleanup = new TokenCleanup(efConfig, 10); cleanup.Start(); // 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.CorsPolicyService = new ClientConfigurationCorsPolicyRegistration(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(AppConfiguration config) { var factory = new IdentityServerServiceFactory(); var scopeStore = new InMemoryScopeStore(Scopes.Get()); factory.ScopeStore = new Registration <IScopeStore>(scopeStore); var clientStore = new InMemoryClientStore(Clients.Get(config)); factory.ClientStore = new Registration <IClientStore>(clientStore); var efConfig = new EntityFrameworkServiceOptions { ConnectionString = "Weee.DefaultConnection", Schema = "Identity" }; factory.RegisterOperationalServices(efConfig); var cleanup = new TokenCleanup(efConfig); cleanup.Start(); string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Weee.DefaultConnection"].ConnectionString; var auditSecurityEventService = new SecurityEventDatabaseAuditor(connectionString); SecurityEventService eventService = new SecurityEventService(auditSecurityEventService); factory.Register <ISecurityEventAuditor>(new Registration <ISecurityEventAuditor>(auditSecurityEventService)); factory.EventService = new Registration <IEventService>(eventService); return(factory); }
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(DefaultClients.Get(), efConfig); ConfigureScopes(DefaultScopes.Get(), efConfig); // ------------------------------------------------ var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(efConfig); factory.RegisterOperationalServices(efConfig); // ----- MembershipReboot user service (pripajanie na ulozisko identit) factory.UserService = new Registration <IUserService, CustomUserService>(); factory.Register(new Registration <CustomUserAccountService>()); factory.Register(new Registration <CustomConfig>(CustomConfig.Config)); factory.Register(new Registration <CustomUserRepository>()); factory.Register(new Registration <CustomDatabase>(resolver => new CustomDatabase(connString))); return(factory); }
public void Configuration(IAppBuilder app) { var efOptions = new EntityFrameworkServiceOptions { ConnectionString = ConfigurationManager.ConnectionStrings["IdSvr3Config"].ConnectionString }; SetupClients(InMemoryManager.GetClients(), efOptions); SetupScopes(InMemoryManager.GetScopes(), efOptions); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(efOptions); factory.RegisterOperationalServices(efOptions); factory.UserService = new Registration <IUserService>(typeof(UserService)); factory.Register(new Registration <IUsuarioRepositorio>(typeof(UsuarioRepositorio))); new TokenCleanup(efOptions, 2).Start(); var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]); var options = new IdentityServerOptions { SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]), RequireSsl = false, Factory = factory }; app.UseIdentityServer(options); }
private IdentityServerServiceFactory ConfigureEFStores() { var connString = ConfigurationManager.ConnectionStrings["IdSvr3Config"].ConnectionString; var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connString }; // client and scope stores... EntityFactory.ConfigureClients(Clients.Get(), efConfig); EntityFactory.ConfigureScopes(Scopes.Get(), efConfig); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(efConfig); factory.RegisterOperationalServices(efConfig); // identity user service EntityFactory.ConfigureUsers(Users.Get(), efConfig); factory.UserService = new Thinktecture.IdentityServer.Core.Configuration.Registration <IUserService, UserService>(); factory.Register(new Thinktecture.IdentityServer.Core.Configuration.Registration <UserManager>()); factory.Register(new Thinktecture.IdentityServer.Core.Configuration.Registration <UserStore>()); factory.Register(new Thinktecture.IdentityServer.Core.Configuration.Registration <UserContext>(resolver => new UserContext(connString))); return(factory); }
public static IdentityServerServiceFactory Configure(AppConfiguration config) { var factory = new IdentityServerServiceFactory(); var scopeStore = new InMemoryScopeStore(Scopes.Get()); factory.ScopeStore = new Registration <IScopeStore>(scopeStore); var clientStore = new InMemoryClientStore(Clients.Get(config)); factory.ClientStore = new Registration <IClientStore>(clientStore); var efConfig = new EntityFrameworkServiceOptions { ConnectionString = "Iws.DefaultConnection", Schema = "Identity" }; factory.RegisterOperationalServices(efConfig); var cleanup = new TokenCleanup(efConfig); cleanup.Start(); return(factory); }
public static void SetUp(EntityFrameworkServiceOptions options) { using (var db = new ClientConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Clients.Any()) { foreach (var c in Clients.Get()) { var e = c.ToEntity(); db.Clients.Add(e); } db.SaveChanges(); } } using (var db = new ScopeConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Scopes.Any()) { foreach (var s in Scopes.Get()) { var e = s.ToEntity(); db.Scopes.Add(e); } db.SaveChanges(); } } }
public static IdentityServerServiceFactory Configure(string connString) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connString, //Schema = "foo", //SynchronousReads = true }; var cleanup = new TokenCleanup(efConfig, 10); cleanup.Start(); // 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.ConfigureClientStoreCache(); //factory.ConfigureScopeStoreCache(); factory.UseInMemoryUsers(Users.Get()); return(factory); }
public static IdentityServerServiceFactory Configure(this IdentityServerServiceFactory factory, string connectionString) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connectionString, //SynchronousReads = true }; // these two calls just pre-populate the test DB from the in-memory config ConfigureClients(Clients.Get(), efConfig); ConfigureScopes(Scopes.Get(), efConfig); ConfigureUsers(Users.Get(), efConfig); var serviceOptions = new EntityFrameworkServiceOptions { ConnectionString = connectionString }; factory.RegisterOperationalServices(serviceOptions); factory.RegisterConfigurationServices(serviceOptions); factory.Register(new Registration <Entities.Context>(resolver => new Entities.Context(connectionString))); factory.Register(new Registration <Entities.UserStore>()); factory.Register(new Registration <Entities.UserManager>()); var userService = new EulaAtLoginUserService(); factory.UserService = new Registration <IUserService>(resolver => userService); factory.ViewService = new Registration <IViewService, CustomViewService>(); return(factory); }
public static IdentityServerServiceFactory Configure(string connString) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connString, //Schema = "dbo" }; var cleanup = new TokenCleanup(efConfig, 10); cleanup.Start(); ConfigureClients(Clients.Get(), efConfig); ConfigureScopes(Scopes.Get(), efConfig); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(efConfig); factory.RegisterOperationalServices(efConfig); factory.CorsPolicyService = new ClientConfigurationCorsPolicyRegistration(efConfig); factory.UserService = new Registration <IUserService, UserService>(); return(factory); }
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); //var scopeStore = new InMemoryScopeStore(Scopes.Get()); //factory.ScopeStore = new Registration<IScopeStore>(scopeStore); //var clientStore = new InMemoryClientStore(Clients.Get()); //factory.ClientStore = new Registration<IClientStore>(clientStore); factory.ConfigureUserService(connString); factory.CorsPolicyService = new Registration <ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true }); return(factory); }
public static void InitClientAndScopeSampleDatas(EntityFrameworkServiceOptions options) { var clients = InMemoryClient.clients; using (var db = new ClientConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Clients.Any()) { foreach (var c in clients) { var e = c.ToEntity(); db.Clients.Add(e); } db.SaveChanges(); } } var scopes = InMemoryScope.scopes; using (var db = new ScopeConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Scopes.Any()) { foreach (var s in scopes) { var e = s.ToEntity(); db.Scopes.Add(e); } db.SaveChanges(); } } }
public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888 var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]); var entityFrameworkOptions = new EntityFrameworkServiceOptions { ConnectionString = ConfigurationManager.ConnectionStrings["TimeKeeperIdentity"].ConnectionString }; var inMemo = new InMemoryManager(); SetupClients(inMemo.GetClients(), entityFrameworkOptions); SetupScopes(inMemo.GetScopes(), entityFrameworkOptions); var unitOfWork = new UnitOfWork(); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(entityFrameworkOptions); factory.RegisterOperationalServices(entityFrameworkOptions); factory.UserService = new Registration <IUserService>(typeof(TimeKeeperUserService)); factory.Register(new Registration <UnitOfWork>(unitOfWork)); var options = new IdentityServerOptions { SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]), RequireSsl = false, Factory = factory }; app.UseIdentityServer(options); }
public static void RegisterScopeStore(this IdentityServerServiceFactory factory, EntityFrameworkServiceOptions options) { if (factory == null) throw new ArgumentNullException("factory"); if (options == null) throw new ArgumentNullException("options"); factory.Register(new Registration<ScopeConfigurationDbContext>(resolver => new ScopeConfigurationDbContext(options.ConnectionString, options.Schema))); factory.ScopeStore = new Registration<IScopeStore, ScopeStore>(); }
public void Configuration(IAppBuilder app) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = IdentityServerDb }; var cleanup = new TokenCleanup(efConfig, 10); cleanup.Start(); // Add in the Clients and Scopes to the EF database IdentityServerTestData.SetUp(efConfig); MembershipTestData.SetUp(MembershipDb, MembershipApplicationName); var factory = new IdentityServerServiceFactory(); factory.RegisterOperationalServices(efConfig); factory.Register(new Registration <IClientConfigurationDbContext>(resolver => new ClientConfigurationDbContext(efConfig.ConnectionString))); factory.RegisterClientDataStore(new Registration <IClientDataStore>(resolver => new ClientDataStore(resolver.Resolve <IClientConfigurationDbContext>()))); factory.CorsPolicyService = new ClientConfigurationCorsPolicyRegistration(efConfig); factory.Register(new Registration <IScopeConfigurationDbContext>(resolver => new ScopeConfigurationDbContext(efConfig.ConnectionString))); factory.RegisterScopeDataStore(new Registration <IScopeDataStore>(resolver => new ScopeDataStore(resolver.Resolve <IScopeConfigurationDbContext>()))); factory.AddVaultClientSecretStore( new VaultClientSecretStoreAppIdOptions { AppId = Program.IdentityServerAppId, UserId = Program.IdentityServerUserId }); factory.UseMembershipService( new MembershipOptions { ConnectionString = ConfigurationManager.ConnectionStrings["Membership"].ConnectionString, ApplicationName = MembershipApplicationName }); var options = new IdentityServerOptions { Factory = factory, RequireSsl = false }; // Wire up Vault as being the X509 Certificate Signing Store options.AddVaultCertificateStore(new VaultCertificateStoreAppIdOptions { AppId = Program.IdentityServerAppId, UserId = Program.IdentityServerUserId, RoleName = RoleName, CommonName = CommonName }); app.UseIdentityServer(options); }
private static void SetupUsers(List <InMemoryUser> getUsers, EntityFrameworkServiceOptions serviceOptions) { try { using (var context = new Context(serviceOptions.ConnectionString)) { if (context.Users.Any()) { return; } foreach (var user in getUsers) { var identityuser = new IdentityUser { UserName = user.Username, PasswordHash = user.Password.Sha256(), }; identityuser.Claims.Add(new IdentityUserClaim { ClaimType = "Subject", ClaimValue = user.Subject, UserId = identityuser.Id }); identityuser.Claims.Add( new IdentityUserClaim { ClaimType = "Name", ClaimValue = "Duhp Dance", UserId = identityuser.Id }); context.Users.Add(identityuser); } context.SaveChanges(); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } catch (Exception) { // ignored } }
public RelyingPartyService(EntityFrameworkServiceOptions options, IRelyingPartyConfigurationDbContext context) { if (context == null) { throw new ArgumentNullException("context"); } this.options = options; this.context = context; }
public void Configuration(IAppBuilder app) { //Log.Logger = new LoggerConfiguration() // .WriteTo.RollingFile("log-{Date}.txt") // .CreateLogger(); Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Trace() .CreateLogger(); var efConfig = new EntityFrameworkServiceOptions { ConnectionString = "DefaultConnection" }; #if DEBUG Database.SetInitializer(new DropCreateDatabaseIfModelChanges <ApplicationDbContext>()); #endif app.Map("/admin", adminApp => { var imgrFactory = new IdentityManagerServiceFactory(); imgrFactory.ConfigureSimpleIdentityManagerService(); adminApp.UseIdentityManager(new IdentityManagerOptions() { Factory = imgrFactory }); }); var factory = new IdentityServerServiceFactory(); factory.RegisterConfigurationServices(efConfig); factory.RegisterOperationalServices(efConfig); factory.ConfigureUserService(); #if DEBUG // these two calls just pre-populate the test DB from the in-memory config TestClients.ConfigureClients(TestClients.Get(), efConfig); TestScopes.ConfigureScopes(TestScopes.Get(), efConfig); #endif var options = new IdentityServerOptions { SiteName = "MyIdentityServer - Server", Factory = factory, RequireSsl = false, SigningCertificate = Certificate.Get(), }; app.UseIdentityServer(options); var cleanup = new TokenCleanup(efConfig, 10); cleanup.Start(); }
private static IdentityServerServiceFactory RegisterIdentityServices( this IdentityServerServiceFactory factory) { var option = new EntityFrameworkServiceOptions { ConnectionString = AppSettings.IdsConnectionString }; factory.RegisterOperationalServices(option); factory.RegisterConfigurationServices(option); return(factory); }
public IdentityServerServiceFactory Initialize(string connectionStringName) { var defaultViewServiceOptions = new DefaultViewServiceOptions(); defaultViewServiceOptions.Stylesheets.Add(_configurationManager.GetByKey("Assets.bulma.css")); defaultViewServiceOptions.Stylesheets.Add(_configurationManager.GetByKey("Assets.error.css")); defaultViewServiceOptions.Stylesheets.Add(_configurationManager.GetByKey("Assets.forgotPassword.css")); defaultViewServiceOptions.Stylesheets.Add(_configurationManager.GetByKey("Assets.login.css")); defaultViewServiceOptions.CacheViews = false; var factory = new IdentityServerServiceFactory(); factory.ConfigureDefaultViewService(defaultViewServiceOptions); var entityFrameworkOptions = new EntityFrameworkServiceOptions { ConnectionString = connectionStringName }; factory.RegisterConfigurationServices(entityFrameworkOptions); factory.RegisterOperationalServices(entityFrameworkOptions); factory.Register(new Registration <CloudPlusAuthDbContext>()); factory.Register(new Registration <UserStore>()); factory.Register(new Registration <RoleStore>()); factory.Register(new Registration <IdentityUserManager>()); factory.Register(new Registration <IdentityRoleManager>()); factory.Register(new Registration <IConfigurationManager, ConfigurationManager>()); factory.Register(new Registration <IImpersonateUserService, ImpersonateUserService>()); factory.Register(new Registration <IHttpClientResolver, HttpClientResolver>()); factory.Register(new Registration <IPermissionService, PermissionService>()); factory.Register(new Registration <CloudPlus.Services.Identity.User.IUserService, UserService>()); factory.Register(new Registration <ITokenProviderService>(x => new TokenProviderService(x.Resolve <IdentityUserManager>(), x.Resolve <CloudPlusAuthDbContext>()))); factory.UserService = new Registration <IUserService>(resolver => new IdentityUserService( resolver.Resolve <IdentityUserManager>(), resolver.Resolve <IImpersonateUserService>(), resolver.Resolve <IConfigurationManager>())); factory.ClaimsProvider = new Registration <IClaimsProvider>(typeof(IdentityClaimsProvider)); factory.CorsPolicyService = new Registration <ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true }); return(factory); }
public string RegisterUser(string name, string role, string emailaddress) { var clientIdGenerator = new ClientIdGenerator(); var clientSecretGenerator = new ClientSecretGenerator(); var repository = new ClientRepository.ClientRepository(); var connectionString = ConfigurationManager.ConnectionStrings["OAuthWCF.IdSrv"].ConnectionString; var options = new EntityFrameworkServiceOptions { ConnectionString = connectionString }; IClientConfigurationDbContext clientdb = new ClientConfigurationDbContext { Database = { Connection = { ConnectionString = connectionString } } }; var clients = new[] { new Client { ClientId = clientIdGenerator.GenerateClientIdAsync(clientdb), ClientSecrets = new List <Secret> { clientSecretGenerator.GenerateSecret(clientdb) }, ClientName = name, Flow = Flows.ClientCredentials, AllowedScopes = new List <string> { role }, Enabled = true, Claims = new List <Claim>() { new Claim(ClaimTypes.Name, name), new Claim(ClaimTypes.Role, role), new Claim(ClaimTypes.Email, emailaddress) }, AllowClientCredentialsOnly = true } }; repository.Add(clients, options); return(string.Join(".", clients.First().ClientId, clients.First().ClientSecrets.First())); }
public TokenCleanupService(EntityFrameworkServiceOptions 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 IdentityServerServiceFactory Configure(string connString) { var efConfig = new EntityFrameworkServiceOptions { ConnectionString = connString, }; var factory = new IdentityServerServiceFactory(); //Clients factory.RegisterConfigurationServices(efConfig); factory.RegisterOperationalServices(efConfig); return(factory); }
public static void ConfigureUserService(this IdentityServerServiceFactory factory, string connString) { factory.UserService = new Registration <IUserService, UserService>(); factory.Register(new Registration <Context.UserManager>()); factory.Register(new Registration <Context.UserStore>()); factory.Register(new Registration <Context>(resolver => new Context(connString))); var efConfig = new EntityFrameworkServiceOptions { ConnectionString = "AspId", Schema = "sec", }; factory.RegisterOperationalServices(efConfig); }
public void Configuration(IAppBuilder appBuilder) { appBuilder.Map("/identity", identityServerAppBuilder => { var identityServerServiceFactory = new IdentityServerServiceFactory(); var entityFrameworkServiceOptions = new EntityFrameworkServiceOptions { ConnectionString = ConfigurationManager.ConnectionStrings["CpimIdentityServerDbConnectionString"].ConnectionString }; identityServerServiceFactory.RegisterClientStore(entityFrameworkServiceOptions); identityServerServiceFactory.UseInMemoryScopes(Scopes.Get()); identityServerServiceFactory.UseInMemoryUsers(Users.Get()); // Add custom user service var userService = new UserService(); identityServerServiceFactory.UserService = new Registration <IUserService>(resolver => userService); var defaultViewServiceOptions = new DefaultViewServiceOptions { CacheViews = false }; defaultViewServiceOptions.Stylesheets.Add("/Styles/site.css"); identityServerServiceFactory.ConfigureDefaultViewService(defaultViewServiceOptions); var options = new IdentityServerOptions { LoggingOptions = new LoggingOptions() { WebApiDiagnosticsIsVerbose = true }, AuthenticationOptions = new AuthenticationOptions { IdentityProviders = ConfigureIdentityProviders }, Factory = identityServerServiceFactory, IssuerUri = Settings.Default.IdentityServerRedirectUri, PublicOrigin = Settings.Default.Origin, RequireSsl = false, SigningCertificate = LoadCertificate(), SiteName = Settings.Default.SiteName }; identityServerAppBuilder.UseIdentityServer(options); ConfigureMvc(); }); }
public static void ConfigureScopes(IEnumerable <Scope> scopes, EntityFrameworkServiceOptions options) { using (var db = new ScopeConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Scopes.Any()) { foreach (var s in scopes) { var e = s.ToEntity(); db.Scopes.Add(e); } db.SaveChanges(); } } }
public static void ConfigureClients(IEnumerable <Client> clients, EntityFrameworkServiceOptions options) { using (var db = new ClientConfigurationDbContext(options.ConnectionString, options.Schema)) { if (!db.Clients.Any()) { foreach (var c in clients) { var e = c.ToEntity(); db.Clients.Add(e); } db.SaveChanges(); } } }
public static void ConfigureUsers(IEnumerable <User> users, EntityFrameworkServiceOptions options) { using (var db = new BaseDbContext(options.ConnectionString, options.Schema)) { if (!db.Database.Exists()) { foreach (var s in users) { //var e = s.ToEntity(); //db.Scopes.Add(e); } //db.SaveChanges(); } } }
public static void RegisterConfigurationServices(this IdentityServerServiceFactory factory, EntityFrameworkServiceOptions options) { factory.RegisterClientStore(options); factory.RegisterScopeStore(options); }