private void InitializeDatabase(IApplicationBuilder app, ConfigSettingsBase settings) { using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { serviceScope.ServiceProvider.GetRequiredService <PersistedGrantDbContext>().Database.Migrate(); var context = serviceScope.ServiceProvider.GetRequiredService <ConfigurationDbContext>(); context.Database.Migrate(); foreach (var client in Config.GetClients(settings)) { if (context.Clients.Where(_ => _.ClientId == client.ClientId).IsNotAny()) { context.Clients.Add(client.ToEntity()); } } context.SaveChanges(); foreach (var identityResource in Config.GetIdentityResources()) { if (context.IdentityResources.Where(_ => _.Name == identityResource.Name).IsNotAny()) { context.IdentityResources.Add(identityResource.ToEntity()); } } context.SaveChanges(); foreach (var apiResource in Config.GetApiResources()) { if (context.ApiResources.Where(_ => _.Name == apiResource.Name).IsNotAny()) { context.ApiResources.Add(apiResource.ToEntity()); } } context.SaveChanges(); } }
public static void Update(ConfigSettingsBase settings, ICache cache, IHostingEnvironment env, ConfigurationDbContext context) { //foreach (var client in Config.GetClients(settings)) //{ // if (context.Clients.Where(_ => _.ClientId == client.ClientId).IsNotAny()) // context.Clients.Add(client.ToEntity()); //} //context.SaveChanges(); //foreach (var ir in Config.GetIdentityResources()) //{ // if (context.IdentityResources.Where(_ => _.Name == ir.Name).IsNotAny()) // context.IdentityResources.Add(ir.ToEntity()); //} //context.SaveChanges(); //foreach (var ar in Config.GetApiResources()) //{ // if (context.ApiResources.Where(_ => _.Name == ar.Name).IsNotAny()) // context.ApiResources.Add(ar.ToEntity()); //} //context.SaveChanges(); }
public DownloadController(ILoggerFactory logger, IHostingEnvironment env, IOptions <ConfigSettingsBase> configSettingsBase, IStorage storage) { this._logger = logger.CreateLogger <DownloadController>(); this._env = env; this._uploadRoot = "upload"; this._storage = storage; this._configSettingsBase = configSettingsBase.Value; }
public static IEnumerable <Client> GetClients(ConfigSettingsBase settings) { return(new List <Client> { new Client { ClientId = "Seed", AllowedGrantTypes = GrantTypes.ResourceOwnerPassword, ClientSecrets = { new Secret("secret".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" } }, new Client { ClientId = "Seed-spa", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = { settings.RedirectUris }, PostLogoutRedirectUris = { settings.PostLogoutRedirectUris }, AllowedCorsOrigins = { settings.ClientAuthorityEndPoint }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 } }); }
public static void InitializeDatabase(IApplicationBuilder app, ConfigSettingsBase settings, ICache cache, IHostingEnvironment env) { using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { serviceScope.ServiceProvider.GetRequiredService <PersistedGrantDbContext>(); var context = serviceScope.ServiceProvider.GetRequiredService <ConfigurationDbContext>(); context.Database.Migrate(); Update(settings, cache, env, context); } }
public EmailQueue( IWebJobRequest webJobRequest, ICircuitBreaker CircuitBreaker, CurrentUser user, IOptions <ConfigSettingsExternalRequest> configSettingsExternalRequest, IOptions <ConfigSettingsBase> configSettingsBase, IOptions <ConfigCircuitBreaker> configCircuitBreaker, IOptions <ConfigEmailBase> configEmailBase, ILoggerFactory iLoggerFactory) { this._webJobRequest = webJobRequest; this._configSettingsExternalRequest = configSettingsExternalRequest.Value; this._configSettingsBase = configSettingsBase.Value; this._configCircuitBreaker = configCircuitBreaker.Value; this._configEmailBase = configEmailBase.Value; this._CircuitBreaker = CircuitBreaker; this._user = user; this._logger = iLoggerFactory.CreateLogger(this.GetType().Name); this.Init(); }
public ResourceOwnerPasswordValidator(IOptions <ConfigSettingsBase> configSettingsBase) { this._settings = configSettingsBase.Value; }
public MemoryComponent(IOptions <ConfigSettingsBase> configSettingsBase) { this._configSettingsBase = configSettingsBase.Value; }
public RedisComponent(IDistributedCache _cache, IOptions <ConfigSettingsBase> configSettingsBase) { this._cache = _cache; this._configSettingsBase = configSettingsBase.Value; }
public RedisStackExchangeComponent(IOptions <ConfigSettingsBase> configSettings, IOptions <ConfigCacheConnectionStringBase> configCache) { this._configSettingsBase = configSettings.Value; RedisStackExchangeComponent.Init(configCache); this._cache = RedisStackExchangeComponent.RedisCache; }
public ResourceOwnerPasswordValidator(IOptions <ConfigSettingsBase> configSettingsBase, IUserCredentialServices userServices) { this._settings = configSettingsBase.Value; this._userServices = userServices; }
public static IEnumerable <Client> GetClients(ConfigSettingsBase settings) { return(new List <Client> { new Client { ClientId = "Seed", AllowedGrantTypes = GrantTypes.ResourceOwnerPassword, ClientSecrets = { new Secret("secret".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" } }, new Client { ClientId = "Seed-spa", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = settings.RedirectUris.ToList(), PostLogoutRedirectUris = settings.PostLogoutRedirectUris.ToList(), AllowedCorsOrigins = settings.ClientAuthorityEndPoint.ToList(), AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "Seed-spa-custom", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = settings.RedirectUris.ToList(), PostLogoutRedirectUris = settings.PostLogoutRedirectUris.ToList(), AllowedCorsOrigins = settings.ClientAuthorityEndPoint.ToList(), AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "hangfire-dash", ClientName = "HangFire Dashboard", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = settings.RedirectUris.ToList(), AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "hangfire-api", AllowedGrantTypes = GrantTypes.ClientCredentials, ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, Claims = new List <Claim> { new Claim(JwtClaimTypes.Subject, "991") }, AccessTokenLifetime = 43200 }, new Client { ClientId = "swagger-dash", ClientName = "swagger Dashboard", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = settings.RedirectUris.ToList(), AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "Seed-spa-anonymous", AllowedGrantTypes = GrantTypes.ClientCredentials, ClientSecrets = { new Secret("4aa288ca-1603-45c2-85c3-b41a08d2bd0a".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, } }); }
public static IEnumerable <Client> GetClients(ConfigSettingsBase settings) { return(new List <Client> { new Client { ClientId = "Seed", AllowedGrantTypes = GrantTypes.ResourceOwnerPassword, ClientSecrets = { new Secret("secret".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" } }, new Client { ClientId = "Seed-spa", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = settings.RedirectUris.ToList(), PostLogoutRedirectUris = settings.PostLogoutRedirectUris.ToList(), AllowedCorsOrigins = settings.ClientAuthorityEndPoint.ToList(), AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "hangfire-dash", ClientName = "HangFire Dashboard", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = { "http://localhost:8123/signin-oidc", }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 }, new Client { ClientId = "hangfire-api", AllowedGrantTypes = GrantTypes.ClientCredentials, ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, Claims = new List <Claim> { new Claim(JwtClaimTypes.Subject, "991") }, AccessTokenLifetime = 43200 }, new Client { ClientId = "swagger-dash", ClientName = "swagger Dashboard", ClientSecrets = { new Secret("segredo".Sha256()) }, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = { "http://localhost:8122/swagger/oauth2-redirect.html", }, AllowedScopes = { StandardScopes.OpenId, StandardScopes.Profile, StandardScopes.Email, "ssosa" }, RequireConsent = false, AccessTokenLifetime = 43200 } }); }
public ResourceOwnerPasswordValidator(IUsuarioRepository rep, IOptions <ConfigSettingsBase> configSettingsBase) { this._rep = rep; this._settings = configSettingsBase.Value; }