From 3acdf880f635629eb58e0439d57043523b7c25e8 Mon Sep 17 00:00:00 2001 From: Sergio Matias Urquin Date: Sun, 18 May 2025 18:56:35 -0600 Subject: [PATCH] remove heath from code --- Core.Thalos.BuildingBlocks/Common/Constants/Schemes.cs | 4 ++-- Core.Thalos.BuildingBlocks/Common/Constants/Secrets.cs | 8 ++++---- .../Extensions/AuthenticationExtension.cs | 2 +- .../Extensions/SwaggerExtensions.cs | 10 +++++----- Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs | 10 +++++----- Core.Thalos.BuildingBlocks/Helpers/RsaHelper.cs | 4 ++-- Core.Thalos.BuildingBlocks/Settings/AuthSettings.cs | 10 +++++----- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Core.Thalos.BuildingBlocks/Common/Constants/Schemes.cs b/Core.Thalos.BuildingBlocks/Common/Constants/Schemes.cs index 90f28b7..b0e176b 100644 --- a/Core.Thalos.BuildingBlocks/Common/Constants/Schemes.cs +++ b/Core.Thalos.BuildingBlocks/Common/Constants/Schemes.cs @@ -6,9 +6,9 @@ public class Schemes { /// - /// The heath scheme. + /// The default scheme. /// - public const string HeathScheme = "HeathScheme"; + public const string DefaultScheme = "DefaultScheme"; /// /// The azure scheme. diff --git a/Core.Thalos.BuildingBlocks/Common/Constants/Secrets.cs b/Core.Thalos.BuildingBlocks/Common/Constants/Secrets.cs index 8817abc..918aab6 100644 --- a/Core.Thalos.BuildingBlocks/Common/Constants/Secrets.cs +++ b/Core.Thalos.BuildingBlocks/Common/Constants/Secrets.cs @@ -49,10 +49,10 @@ namespace Core.Thalos.Adapters.Common.Constants public const string AzureADTenantId = "B2C:TenantId"; public const string AzureADClientId = "B2C:ClientId"; public const string AzureADClientSecret = "B2C:ClientSecret"; - public const string HeathThalosAppAuthorizationUrl = "Swagger:AuthorizationUri"; - public const string HeathThalosAppTokenUrl = "Swagger:TokenUri"; - public const string HeathThalosAppClientId = "Swagger:ClientId"; - public const string HeathThalosAppScope = "Swagger:Scope"; + public const string ThalosAppAuthorizationUrl = "Swagger:AuthorizationUri"; + public const string ThalosAppTokenUrl = "Swagger:TokenUri"; + public const string ThalosAppClientId = "Swagger:ClientId"; + public const string ThalosAppScope = "Swagger:Scope"; public const string PrivateKey = "B2C:JwtIssuerOptions:TokenPrivateKey"; public const string PublicKey = "B2C:JwtIssuerOptions:TokenPublicKey"; } diff --git a/Core.Thalos.BuildingBlocks/Extensions/AuthenticationExtension.cs b/Core.Thalos.BuildingBlocks/Extensions/AuthenticationExtension.cs index 8374071..ced7b87 100644 --- a/Core.Thalos.BuildingBlocks/Extensions/AuthenticationExtension.cs +++ b/Core.Thalos.BuildingBlocks/Extensions/AuthenticationExtension.cs @@ -68,7 +68,7 @@ namespace Core.Thalos.Adapters.Extensions throw new InvalidOperationException("JwtIssuerOptions are not configured correctly."); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(Schemes.HeathScheme, x => + .AddJwtBearer(Schemes.DefaultScheme, x => { x.TokenValidationParameters = new TokenValidationParameters { diff --git a/Core.Thalos.BuildingBlocks/Extensions/SwaggerExtensions.cs b/Core.Thalos.BuildingBlocks/Extensions/SwaggerExtensions.cs index 17c87d3..d4b7ecd 100644 --- a/Core.Thalos.BuildingBlocks/Extensions/SwaggerExtensions.cs +++ b/Core.Thalos.BuildingBlocks/Extensions/SwaggerExtensions.cs @@ -53,11 +53,11 @@ namespace Core.Thalos.Adapters.Extensions { AuthorizationCode = new OpenApiOAuthFlow { - AuthorizationUrl = new Uri(authSettings.HeathThalosAppAuthorizationUrl ?? string.Empty), - TokenUrl = new Uri(authSettings.HeathThalosAppTokenUrl ?? string.Empty), + AuthorizationUrl = new Uri(authSettings.ThalosAppAuthorizationUrl ?? string.Empty), + TokenUrl = new Uri(authSettings.ThalosAppTokenUrl ?? string.Empty), Scopes = new Dictionary { - { authSettings.HeathThalosAppScope ?? string.Empty, "Access API as User" } + { authSettings.ThalosAppScope ?? string.Empty, "Access API as User" } } } } @@ -70,7 +70,7 @@ namespace Core.Thalos.Adapters.Extensions { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" } }, - new[] { authSettings.HeathThalosAppScope } + new[] { authSettings.ThalosAppScope } } }); @@ -134,7 +134,7 @@ namespace Core.Thalos.Adapters.Extensions app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Custom Auth API with Azure AD v1"); - options.OAuthClientId(authSettings.HeathThalosAppClientId); + options.OAuthClientId(authSettings.ThalosAppClientId); options.OAuthUsePkce(); options.OAuthScopeSeparator(" "); }); diff --git a/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs b/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs index 63fc6ea..ecddcfb 100644 --- a/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs +++ b/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs @@ -25,7 +25,7 @@ namespace Core.Thalos.Adapters.Helpers throw new ArgumentException("The app configuration is missing"); options.Connect(new Uri(endpoint), new DefaultAzureCredential()) - .Select(KeyFilter.Any, "cerberos_common") + .Select(KeyFilter.Any, "thalos_common") .Select(KeyFilter.Any, appConfigLabel); options.ConfigureKeyVault(keyVaultOptions => @@ -40,10 +40,10 @@ namespace Core.Thalos.Adapters.Helpers AzureADTenantId = builder.Configuration.GetSection(Secrets.AzureADTenantId).Value, AzureADClientId = builder.Configuration.GetSection(Secrets.AzureADClientId).Value, AzureADClientSecret = builder.Configuration.GetSection(Secrets.AzureADClientSecret).Value, - HeathThalosAppAuthorizationUrl = builder.Configuration.GetSection(Secrets.HeathThalosAppAuthorizationUrl).Value, - HeathThalosAppTokenUrl = builder.Configuration.GetSection(Secrets.HeathThalosAppTokenUrl).Value, - HeathThalosAppClientId = builder.Configuration.GetSection(Secrets.HeathThalosAppClientId).Value, - HeathThalosAppScope = builder.Configuration.GetSection(Secrets.HeathThalosAppScope).Value, + ThalosAppAuthorizationUrl = builder.Configuration.GetSection(Secrets.ThalosAppAuthorizationUrl).Value, + ThalosAppTokenUrl = builder.Configuration.GetSection(Secrets.ThalosAppTokenUrl).Value, + ThalosAppClientId = builder.Configuration.GetSection(Secrets.ThalosAppClientId).Value, + ThalosAppScope = builder.Configuration.GetSection(Secrets.ThalosAppScope).Value, PrivateKey = builder.Configuration.GetSection(Secrets.PrivateKey).Value, PublicKey = builder.Configuration.GetSection(Secrets.PublicKey).Value, }; diff --git a/Core.Thalos.BuildingBlocks/Helpers/RsaHelper.cs b/Core.Thalos.BuildingBlocks/Helpers/RsaHelper.cs index 047ab3b..bb849fc 100644 --- a/Core.Thalos.BuildingBlocks/Helpers/RsaHelper.cs +++ b/Core.Thalos.BuildingBlocks/Helpers/RsaHelper.cs @@ -62,7 +62,7 @@ namespace Core.Thalos.Adapters.Helpers /// The private key. private RSACryptoServiceProvider GetPrivateKeyFromPemFile() { - using (TextReader privateKeyTextReader = new StringReader(File.ReadAllText(Path.Combine(exeDirectory, "HeathPrivateKey.pem")))) + using (TextReader privateKeyTextReader = new StringReader(File.ReadAllText(Path.Combine(exeDirectory, "PrivateKey.pem")))) { AsymmetricCipherKeyPair readKeyPair = (AsymmetricCipherKeyPair)new PemReader(privateKeyTextReader).ReadObject(); @@ -79,7 +79,7 @@ namespace Core.Thalos.Adapters.Helpers /// The public key. public RSACryptoServiceProvider GetPublicKeyFromPemFile() { - using (TextReader publicKeyTextReader = new StringReader(File.ReadAllText(Path.Combine(exeDirectory, "HeathPublicKey.pem")))) + using (TextReader publicKeyTextReader = new StringReader(File.ReadAllText(Path.Combine(exeDirectory, "PublicKey.pem")))) { RsaKeyParameters publicKeyParam = (RsaKeyParameters)new PemReader(publicKeyTextReader).ReadObject(); diff --git a/Core.Thalos.BuildingBlocks/Settings/AuthSettings.cs b/Core.Thalos.BuildingBlocks/Settings/AuthSettings.cs index 585077a..94bf189 100644 --- a/Core.Thalos.BuildingBlocks/Settings/AuthSettings.cs +++ b/Core.Thalos.BuildingBlocks/Settings/AuthSettings.cs @@ -12,11 +12,11 @@ public class AuthSettings public string? AzureADClientId { get; set; } public string? AzureADClientSecret { get; set; } - // Heath Thalos App Settings - public string? HeathThalosAppAuthorizationUrl { get; set; } - public string? HeathThalosAppTokenUrl { get; set; } - public string? HeathThalosAppClientId { get; set; } - public string? HeathThalosAppScope { get; set; } + //Thalos App Settings + public string? ThalosAppAuthorizationUrl { get; set; } + public string? ThalosAppTokenUrl { get; set; } + public string? ThalosAppClientId { get; set; } + public string? ThalosAppScope { get; set; } // Token Keys public string? PrivateKey { get; set; }