From 99aa9b6c04866b381cc4cc73845aec6cfedd17b0 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Tue, 25 Jan 2022 23:29:03 +0100 Subject: [PATCH 1/6] Implemented IPersistedGrantStore --- .../EthernaSSO.Persistence.csproj | 2 +- ...DbSeedSettings.cs => SsoDbSeedSettings.cs} | 2 +- src/EthernaSSO.Persistence/SsoDbContext.cs | 4 +- .../SystemStore/PersistedGrantRepository.cs | 97 +++++++++++++++++++ src/EthernaSSO/Startup.cs | 11 ++- 5 files changed, 110 insertions(+), 6 deletions(-) rename src/EthernaSSO.Persistence/Settings/{DbSeedSettings.cs => SsoDbSeedSettings.cs} (95%) create mode 100644 src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs diff --git a/src/EthernaSSO.Persistence/EthernaSSO.Persistence.csproj b/src/EthernaSSO.Persistence/EthernaSSO.Persistence.csproj index 691b4dc4..d2999e55 100644 --- a/src/EthernaSSO.Persistence/EthernaSSO.Persistence.csproj +++ b/src/EthernaSSO.Persistence/EthernaSSO.Persistence.csproj @@ -1,4 +1,4 @@ - + net5.0 diff --git a/src/EthernaSSO.Persistence/Settings/DbSeedSettings.cs b/src/EthernaSSO.Persistence/Settings/SsoDbSeedSettings.cs similarity index 95% rename from src/EthernaSSO.Persistence/Settings/DbSeedSettings.cs rename to src/EthernaSSO.Persistence/Settings/SsoDbSeedSettings.cs index 05b979d7..9d705c5d 100644 --- a/src/EthernaSSO.Persistence/Settings/DbSeedSettings.cs +++ b/src/EthernaSSO.Persistence/Settings/SsoDbSeedSettings.cs @@ -14,7 +14,7 @@ namespace Etherna.SSOServer.Persistence.Settings { - public class DbSeedSettings + public class SsoDbSeedSettings { public string FirstAdminUsername { get; set; } = default!; public string FirstAdminPassword { get; set; } = default!; diff --git a/src/EthernaSSO.Persistence/SsoDbContext.cs b/src/EthernaSSO.Persistence/SsoDbContext.cs index 2d0e994c..14ef0e7b 100644 --- a/src/EthernaSSO.Persistence/SsoDbContext.cs +++ b/src/EthernaSSO.Persistence/SsoDbContext.cs @@ -39,13 +39,13 @@ public class SsoDbContext : DbContext, IEventDispatcherDbContext, ISsoDbContext private const string ModelMapsNamespace = "Etherna.SSOServer.Persistence.ModelMaps.Sso"; // Fields. - private readonly DbSeedSettings seedSettings; + private readonly SsoDbSeedSettings seedSettings; private readonly IServiceProvider serviceProvider; // Constructor. public SsoDbContext( IEventDispatcher eventDispatcher, - DbSeedSettings seedSettings, + SsoDbSeedSettings seedSettings, IServiceProvider serviceProvider) { EventDispatcher = eventDispatcher; diff --git a/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs b/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs new file mode 100644 index 00000000..e8ac8aff --- /dev/null +++ b/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs @@ -0,0 +1,97 @@ +using Etherna.MongoDB.Bson.Serialization; +using Etherna.MongoDB.Bson.Serialization.Conventions; +using Etherna.MongoDB.Driver; +using Etherna.MongoDB.Driver.Linq; +using Etherna.MongODM.Core.Options; +using IdentityServer4.Extensions; +using IdentityServer4.Models; +using IdentityServer4.Stores; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Etherna.SSOServer.Configs.SystemStore +{ + public class PersistedGrantRepository : IPersistedGrantStore + { + // Consts. + public const string KeyIndexName = "keys_unique"; + + // Fields. + private readonly IMongoCollection collection; + + // Constructor. + public PersistedGrantRepository(DbContextOptions options, string name) + { + if (options is null) + throw new ArgumentNullException(nameof(options)); + + // Register class map. (see: https://etherna.atlassian.net/browse/ESSO-140) + BsonClassMap.RegisterClassMap(cm => + { + cm.AutoMap(); + cm.MapIdProperty(x => x.Key); + }); + + // Register discriminator convention. Default from MongODM doesn't work without DbContext. + BsonSerializer.RegisterDiscriminatorConvention(typeof(PersistedGrant), + StandardDiscriminatorConvention.Hierarchical); + + // Initialize MongoDB driver. + var client = new MongoClient(options.ConnectionString); + var database = client.GetDatabase(options.DbName); + collection = database.GetCollection(name); + } + + // Methods. + public async Task> GetAllAsync(PersistedGrantFilter filter) + { + if (filter is null) + throw new ArgumentNullException(nameof(filter)); + filter.Validate(); + + var cursor = await collection.FindAsync(BuildMongoFilterHelper(filter)); + return await cursor.ToListAsync(); + } + + public Task GetAsync(string key) => + collection.AsQueryable() + .SingleOrDefaultAsync(x => x.Key == key); + + public Task RemoveAllAsync(PersistedGrantFilter filter) + { + if (filter is null) + throw new ArgumentNullException(nameof(filter)); + filter.Validate(); + + return collection.DeleteManyAsync(BuildMongoFilterHelper(filter)); + } + + public Task RemoveAsync(string key) => + collection.DeleteOneAsync(x => x.Key == key); + + public Task StoreAsync(PersistedGrant grant) => + collection.ReplaceOneAsync(x => x.Key == grant.Key, grant, new ReplaceOptions { IsUpsert = true }); + + // Helpers. + private FilterDefinition BuildMongoFilterHelper(PersistedGrantFilter sourceFilter) + { + var fieldFilters = new List>(); + + if (!string.IsNullOrWhiteSpace(sourceFilter.ClientId)) + fieldFilters.Add(Builders.Filter.Eq(x => x.ClientId, sourceFilter.ClientId)); + + if (!string.IsNullOrWhiteSpace(sourceFilter.SessionId)) + fieldFilters.Add(Builders.Filter.Eq(x => x.SessionId, sourceFilter.SessionId)); + + if (!string.IsNullOrWhiteSpace(sourceFilter.SubjectId)) + fieldFilters.Add(Builders.Filter.Eq(x => x.SubjectId, sourceFilter.SubjectId)); + + if (!string.IsNullOrWhiteSpace(sourceFilter.Type)) + fieldFilters.Add(Builders.Filter.Eq(x => x.Type, sourceFilter.Type)); + + return Builders.Filter.And(fieldFilters); + } + } +} diff --git a/src/EthernaSSO/Startup.cs b/src/EthernaSSO/Startup.cs index d6d07fe3..0cc18abe 100644 --- a/src/EthernaSSO/Startup.cs +++ b/src/EthernaSSO/Startup.cs @@ -24,6 +24,7 @@ using Etherna.SSOServer.Configs.Identity; using Etherna.SSOServer.Configs.IdentityServer; using Etherna.SSOServer.Configs.Swagger; +using Etherna.SSOServer.Configs.SystemStore; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Models; using Etherna.SSOServer.Extensions; @@ -36,6 +37,7 @@ using Hangfire.Mongo; using Hangfire.Mongo.Migration.Strategies; using Hangfire.Mongo.Migration.Strategies.Backup; +using IdentityServer4.Stores; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization.Infrastructure; @@ -239,6 +241,11 @@ public void ConfigureServices(IServiceCollection services) #pragma warning restore CA2000 // Dispose objects before losing scope } + services.AddSingleton(new PersistedGrantRepository(new DbContextOptions + { + ConnectionString = Configuration["ConnectionStrings:DataProtectionDb"] ?? throw new ServiceConfigurationException() + }, "persistedGrants")); + // Configure Hangfire server. if (!Environment.IsStaging()) //don't start server in staging { @@ -277,7 +284,7 @@ public void ConfigureServices(IServiceCollection services) options.AssemblyVersion = assemblyVersion.Version; }); services.Configure(Configuration.GetSection("Email") ?? throw new ServiceConfigurationException()); - services.Configure(Configuration.GetSection("DbSeed") ?? throw new ServiceConfigurationException()); + services.Configure(Configuration.GetSection("DbSeed") ?? throw new ServiceConfigurationException()); // Configure persistence. services.AddMongODMWithHangfire(configureHangfireOptions: options => @@ -298,7 +305,7 @@ public void ConfigureServices(IServiceCollection services) .AddDbContext(sp => { var eventDispatcher = sp.GetRequiredService(); - var seedSettings = sp.GetRequiredService>(); + var seedSettings = sp.GetRequiredService>(); return new SsoDbContext(eventDispatcher, seedSettings.Value, sp); }, options => From 6c2e95827f547ad7496f9386214c973694570782 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Tue, 25 Jan 2022 23:41:26 +0100 Subject: [PATCH 2/6] Migrated to EthernaACR --- src/EthernaSSO.Domain/EthernaSSO.Domain.csproj | 2 +- src/EthernaSSO.Domain/Models/UserBase.cs | 2 +- src/EthernaSSO.Services/Domain/UserService.cs | 2 +- src/EthernaSSO.Services/ServiceCollectionExtensions.cs | 2 +- src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs | 4 ++-- src/EthernaSSO/Areas/Admin/Pages/_ViewImports.cshtml | 4 ++-- .../Areas/Api/Services/IdentityControllerService.cs | 2 +- .../Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs | 2 +- .../Areas/Identity/Pages/Account/Manage/Email.cshtml.cs | 2 +- .../Areas/Identity/Pages/Account/SetVerifiedEmail.cshtml.cs | 4 ++-- src/EthernaSSO/Configs/IdentityServer/IdServerConfig.cs | 2 +- src/EthernaSSO/Program.cs | 4 ++-- src/EthernaSSO/Startup.cs | 4 ++-- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/EthernaSSO.Domain/EthernaSSO.Domain.csproj b/src/EthernaSSO.Domain/EthernaSSO.Domain.csproj index f384457c..f620034f 100644 --- a/src/EthernaSSO.Domain/EthernaSSO.Domain.csproj +++ b/src/EthernaSSO.Domain/EthernaSSO.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/EthernaSSO.Domain/Models/UserBase.cs b/src/EthernaSSO.Domain/Models/UserBase.cs index f9aa4fe4..6eaed8b6 100644 --- a/src/EthernaSSO.Domain/Models/UserBase.cs +++ b/src/EthernaSSO.Domain/Models/UserBase.cs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Helpers; using Etherna.Authentication; using Etherna.MongODM.Core.Attributes; -using Etherna.SSL.Helpers; using Etherna.SSOServer.Domain.Helpers; using Etherna.SSOServer.Domain.Models.UserAgg; using Microsoft.AspNetCore.Identity; diff --git a/src/EthernaSSO.Services/Domain/UserService.cs b/src/EthernaSSO.Services/Domain/UserService.cs index 45aae922..145fad04 100644 --- a/src/EthernaSSO.Services/Domain/UserService.cs +++ b/src/EthernaSSO.Services/Domain/UserService.cs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Helpers; using Etherna.MongoDB.Bson; using Etherna.MongoDB.Driver.Linq; using Etherna.MongODM.Core.Exceptions; using Etherna.MongODM.Core.Repositories; -using Etherna.SSL.Helpers; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Helpers; using Etherna.SSOServer.Domain.Models; diff --git a/src/EthernaSSO.Services/ServiceCollectionExtensions.cs b/src/EthernaSSO.Services/ServiceCollectionExtensions.cs index 634ff210..96f0ae77 100644 --- a/src/EthernaSSO.Services/ServiceCollectionExtensions.cs +++ b/src/EthernaSSO.Services/ServiceCollectionExtensions.cs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR; using Etherna.DomainEvents; using Etherna.DomainEvents.AspNetCore; -using Etherna.SSL; using Etherna.SSOServer.Services.Domain; using Etherna.SSOServer.Services.Tasks; using Microsoft.Extensions.DependencyInjection; diff --git a/src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs b/src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs index c5f2038f..6eb9f362 100644 --- a/src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs +++ b/src/EthernaSSO/Areas/Admin/Pages/Invitations/Index.cshtml.cs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Helpers; +using Etherna.ACR.Services; using Etherna.MongoDB.Driver.Linq; -using Etherna.SSL.Helpers; -using Etherna.SSL.Services; using Etherna.SSOServer.Configs; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Models; diff --git a/src/EthernaSSO/Areas/Admin/Pages/_ViewImports.cshtml b/src/EthernaSSO/Areas/Admin/Pages/_ViewImports.cshtml index 012d112d..c041e1db 100644 --- a/src/EthernaSSO/Areas/Admin/Pages/_ViewImports.cshtml +++ b/src/EthernaSSO/Areas/Admin/Pages/_ViewImports.cshtml @@ -14,8 +14,8 @@ *@ @using Microsoft.AspNetCore.Identity -@using Etherna.SSL -@using Etherna.SSL.Pages.SharedModels +@using Etherna.ACR +@using Etherna.ACR.Pages.SharedModels @using Etherna.SSOServer.Areas.Admin @using Etherna.SSOServer.Areas.Admin.Pages @using Etherna.SSOServer.Configs diff --git a/src/EthernaSSO/Areas/Api/Services/IdentityControllerService.cs b/src/EthernaSSO/Areas/Api/Services/IdentityControllerService.cs index 0d82e1f4..a896a690 100644 --- a/src/EthernaSSO/Areas/Api/Services/IdentityControllerService.cs +++ b/src/EthernaSSO/Areas/Api/Services/IdentityControllerService.cs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Helpers; using Etherna.MongoDB.Driver.Linq; -using Etherna.SSL.Helpers; using Etherna.SSOServer.Areas.Api.DtoModels; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Helpers; diff --git a/src/EthernaSSO/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs b/src/EthernaSSO/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs index 029ed725..614012f5 100644 --- a/src/EthernaSSO/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs +++ b/src/EthernaSSO/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Etherna.SSL.Services; +using Etherna.ACR.Services; using Etherna.SSOServer.Configs; using Etherna.SSOServer.Domain.Models; using Microsoft.AspNetCore.Authorization; diff --git a/src/EthernaSSO/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs b/src/EthernaSSO/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs index 005affc6..4992d8eb 100644 --- a/src/EthernaSSO/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs +++ b/src/EthernaSSO/Areas/Identity/Pages/Account/Manage/Email.cshtml.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Etherna.SSL.Services; +using Etherna.ACR.Services; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Models; using Microsoft.AspNetCore.Identity; diff --git a/src/EthernaSSO/Areas/Identity/Pages/Account/SetVerifiedEmail.cshtml.cs b/src/EthernaSSO/Areas/Identity/Pages/Account/SetVerifiedEmail.cshtml.cs index 22edacf6..e1fd1983 100644 --- a/src/EthernaSSO/Areas/Identity/Pages/Account/SetVerifiedEmail.cshtml.cs +++ b/src/EthernaSSO/Areas/Identity/Pages/Account/SetVerifiedEmail.cshtml.cs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Etherna.SSL.Helpers; -using Etherna.SSL.Services; +using Etherna.ACR.Helpers; +using Etherna.ACR.Services; using Etherna.SSOServer.Domain; using Etherna.SSOServer.Domain.Models; using Etherna.SSOServer.Services.Views.Emails; diff --git a/src/EthernaSSO/Configs/IdentityServer/IdServerConfig.cs b/src/EthernaSSO/Configs/IdentityServer/IdServerConfig.cs index 59cd95cb..020546b3 100644 --- a/src/EthernaSSO/Configs/IdentityServer/IdServerConfig.cs +++ b/src/EthernaSSO/Configs/IdentityServer/IdServerConfig.cs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Exceptions; using Etherna.Authentication; -using Etherna.SSL.Exceptions; using IdentityServer4; using IdentityServer4.Models; using Microsoft.Extensions.Configuration; diff --git a/src/EthernaSSO/Program.cs b/src/EthernaSSO/Program.cs index 9db65c8e..5a9f4888 100644 --- a/src/EthernaSSO/Program.cs +++ b/src/EthernaSSO/Program.cs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Etherna.SSL.Exceptions; -using Etherna.SSL.Filters; +using Etherna.ACR.Exceptions; +using Etherna.ACR.Filters; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; diff --git a/src/EthernaSSO/Startup.cs b/src/EthernaSSO/Startup.cs index 0cc18abe..c0ea5f73 100644 --- a/src/EthernaSSO/Startup.cs +++ b/src/EthernaSSO/Startup.cs @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using Etherna.ACR.Exceptions; +using Etherna.ACR.Settings; using Etherna.DomainEvents; using Etherna.MongODM; using Etherna.MongODM.AspNetCore.UI; using Etherna.MongODM.Core.Options; -using Etherna.SSL.Exceptions; -using Etherna.SSL.Settings; using Etherna.SSOServer.Configs; using Etherna.SSOServer.Configs.Authorization; using Etherna.SSOServer.Configs.Hangfire; From 105afe33a82f787546271eb1a22d737d199109f7 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Tue, 25 Jan 2022 23:44:38 +0100 Subject: [PATCH 3/6] removed "hotfix" and "release" branch releases --- .github/workflows/unstable-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/unstable-release.yml b/.github/workflows/unstable-release.yml index b021b9f2..da178a73 100644 --- a/.github/workflows/unstable-release.yml +++ b/.github/workflows/unstable-release.yml @@ -4,8 +4,6 @@ on: push: branches: - dev - - 'hotfix/**' - - 'release/**' jobs: build: From 6f3826e53985833e2478d05f7d7fa86e1e2a2832 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Tue, 25 Jan 2022 23:54:58 +0100 Subject: [PATCH 4/6] Implemented KnownNetworks configuration --- src/EthernaSSO/Startup.cs | 20 ++++++++++++++++++++ src/EthernaSSO/appsettings.Development.json | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/src/EthernaSSO/Startup.cs b/src/EthernaSSO/Startup.cs index c0ea5f73..c86e2acf 100644 --- a/src/EthernaSSO/Startup.cs +++ b/src/EthernaSSO/Startup.cs @@ -55,7 +55,9 @@ using Swashbuckle.AspNetCore.SwaggerGen; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; +using System.Linq; using System.Net; using System.Reflection; using System.Security.Cryptography.X509Certificates; @@ -134,6 +136,24 @@ public void ConfigureServices(IServiceCollection services) services.Configure(options => { options.ForwardedHeaders = ForwardedHeaders.All; + + var knownNetworksConfig = Configuration.GetSection("ForwardedHeaders:KnownNetworks"); + if (knownNetworksConfig.Exists()) + { + var networks = knownNetworksConfig.Get().Select(address => + { + var parts = address.Split('/'); + if (parts.Length != 2) + throw new ServiceConfigurationException(); + + return new IPNetwork( + IPAddress.Parse(parts[0]), + int.Parse(parts[1], CultureInfo.InvariantCulture)); + }); + + foreach (var network in networks) + options.KnownNetworks.Add(network); + } }); services.AddCors(); diff --git a/src/EthernaSSO/appsettings.Development.json b/src/EthernaSSO/appsettings.Development.json index bc4b2d01..ab6d580c 100644 --- a/src/EthernaSSO/appsettings.Development.json +++ b/src/EthernaSSO/appsettings.Development.json @@ -40,6 +40,12 @@ //"ServiceUser": "service_user" }, + "ForwardedHeaders": { + "KnownNetworks": [ + //"10.0.0.0/8" + ] + }, + "IdServer": { "Clients": { "EthernaCredit": { From 8a13feaf98f5a1add3b3cc2ec34cef331abd318c Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Wed, 26 Jan 2022 00:01:09 +0100 Subject: [PATCH 5/6] Revert "Implemented host filter for production" This reverts commit 152499b094b0b98338aa2a722014ccafe5a86da8. --- src/EthernaSSO/appsettings.Development.json | 2 -- src/EthernaSSO/appsettings.Production.json | 2 -- src/EthernaSSO/appsettings.json | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EthernaSSO/appsettings.Development.json b/src/EthernaSSO/appsettings.Development.json index ab6d580c..8ddfb6d3 100644 --- a/src/EthernaSSO/appsettings.Development.json +++ b/src/EthernaSSO/appsettings.Development.json @@ -1,6 +1,4 @@ { - "AllowedHosts": "*", - "Application": { "DisplayName": "Etherna SSO Dev", "RequireInvitation": false diff --git a/src/EthernaSSO/appsettings.Production.json b/src/EthernaSSO/appsettings.Production.json index 3e85ea72..de200f7f 100644 --- a/src/EthernaSSO/appsettings.Production.json +++ b/src/EthernaSSO/appsettings.Production.json @@ -1,6 +1,4 @@ { - "AllowedHosts": "sso.etherna.io", - "Application": { "DisplayName": "Etherna SSO", "RequireInvitation": true diff --git a/src/EthernaSSO/appsettings.json b/src/EthernaSSO/appsettings.json index 1ac6dc18..3139702e 100644 --- a/src/EthernaSSO/appsettings.json +++ b/src/EthernaSSO/appsettings.json @@ -1,4 +1,6 @@ { + "AllowedHosts": "*", + "Application": { "CompactName": "ethernaSso" }, From cad1475a7c44606d05026ed444ae04853d9db032 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Wed, 26 Jan 2022 00:21:55 +0100 Subject: [PATCH 6/6] Added license headers --- src/EthernaSSO.Domain/ISharedDbContext.cs | 16 +++++++++++++++- .../Models/UserAgg/UserSharedInfo.cs | 16 +++++++++++++++- src/EthernaSSO.Persistence/SharedDbContext.cs | 16 +++++++++++++++- .../DenyBannedAuthorizationHandler.cs | 16 +++++++++++++++- .../DenyBannedAuthorizationRequirement.cs | 16 +++++++++++++++- .../SystemStore/PersistedGrantRepository.cs | 16 +++++++++++++++- 6 files changed, 90 insertions(+), 6 deletions(-) diff --git a/src/EthernaSSO.Domain/ISharedDbContext.cs b/src/EthernaSSO.Domain/ISharedDbContext.cs index 2515a458..571150df 100644 --- a/src/EthernaSSO.Domain/ISharedDbContext.cs +++ b/src/EthernaSSO.Domain/ISharedDbContext.cs @@ -1,4 +1,18 @@ -using Etherna.MongODM.Core; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Etherna.MongODM.Core; using Etherna.MongODM.Core.Repositories; using Etherna.SSOServer.Domain.Models.UserAgg; diff --git a/src/EthernaSSO.Domain/Models/UserAgg/UserSharedInfo.cs b/src/EthernaSSO.Domain/Models/UserAgg/UserSharedInfo.cs index ddc6b151..d781348f 100644 --- a/src/EthernaSSO.Domain/Models/UserAgg/UserSharedInfo.cs +++ b/src/EthernaSSO.Domain/Models/UserAgg/UserSharedInfo.cs @@ -1,4 +1,18 @@ -using Microsoft.AspNetCore.Identity; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Microsoft.AspNetCore.Identity; using Nethereum.Util; using System; using System.Collections.Generic; diff --git a/src/EthernaSSO.Persistence/SharedDbContext.cs b/src/EthernaSSO.Persistence/SharedDbContext.cs index 092e9408..b314dcfd 100644 --- a/src/EthernaSSO.Persistence/SharedDbContext.cs +++ b/src/EthernaSSO.Persistence/SharedDbContext.cs @@ -1,4 +1,18 @@ -using Etherna.DomainEvents; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Etherna.DomainEvents; using Etherna.MongoDB.Driver; using Etherna.MongODM.Core; using Etherna.MongODM.Core.Repositories; diff --git a/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationHandler.cs b/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationHandler.cs index 1e031a00..da2cb1b5 100644 --- a/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationHandler.cs +++ b/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationHandler.cs @@ -1,4 +1,18 @@ -using Etherna.SSOServer.Domain.Models; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Etherna.SSOServer.Domain.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using System; diff --git a/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationRequirement.cs b/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationRequirement.cs index 67be66da..9ca9330b 100644 --- a/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationRequirement.cs +++ b/src/EthernaSSO/Configs/Authorization/DenyBannedAuthorizationRequirement.cs @@ -1,4 +1,18 @@ -using Microsoft.AspNetCore.Authorization; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Microsoft.AspNetCore.Authorization; namespace Etherna.SSOServer.Configs.Authorization { diff --git a/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs b/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs index e8ac8aff..c8b679e1 100644 --- a/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs +++ b/src/EthernaSSO/Configs/SystemStore/PersistedGrantRepository.cs @@ -1,4 +1,18 @@ -using Etherna.MongoDB.Bson.Serialization; +// Copyright 2021-present Etherna Sagl +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Etherna.MongoDB.Bson.Serialization; using Etherna.MongoDB.Bson.Serialization.Conventions; using Etherna.MongoDB.Driver; using Etherna.MongoDB.Driver.Linq;