From f8851900fdfb2b3e9b442f6dc20e26533af2735e Mon Sep 17 00:00:00 2001 From: Tatsuro Shibamura Date: Sat, 13 May 2023 15:56:28 +0900 Subject: [PATCH] Cleanup code and update packages (#591) --- KeyVault.Acmebot/Internal/AccountKey.cs | 4 ++-- KeyVault.Acmebot/Internal/AppRoleExtensions.cs | 7 +------ KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs | 5 +---- KeyVault.Acmebot/KeyVault.Acmebot.csproj | 4 ++-- KeyVault.Acmebot/Providers/GoDaddyProvider.cs | 3 ++- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/KeyVault.Acmebot/Internal/AccountKey.cs b/KeyVault.Acmebot/Internal/AccountKey.cs index ccee3d4b..0ad030f6 100644 --- a/KeyVault.Acmebot/Internal/AccountKey.cs +++ b/KeyVault.Acmebot/Internal/AccountKey.cs @@ -15,7 +15,7 @@ public IJwsTool GenerateSigner() { var tool = new ACMESharp.Crypto.JOSE.Impl.ESJwsTool { - HashSize = int.Parse(KeyType.Substring(2)) + HashSize = int.Parse(KeyType[2..]) }; tool.Init(); tool.Import(KeyExport); @@ -26,7 +26,7 @@ public IJwsTool GenerateSigner() { var tool = new ACMESharp.Crypto.JOSE.Impl.RSJwsTool { - KeySize = int.Parse(KeyType.Substring(2)) + KeySize = int.Parse(KeyType[2..]) }; tool.Init(); tool.Import(KeyExport); diff --git a/KeyVault.Acmebot/Internal/AppRoleExtensions.cs b/KeyVault.Acmebot/Internal/AppRoleExtensions.cs index 08611697..705cb251 100644 --- a/KeyVault.Acmebot/Internal/AppRoleExtensions.cs +++ b/KeyVault.Acmebot/Internal/AppRoleExtensions.cs @@ -11,12 +11,7 @@ internal static class AppRoleExtensions private static bool IsAppRoleRequired => bool.TryParse(Environment.GetEnvironmentVariable("Acmebot:AppRoleRequired"), out var result) && result; - private static bool IsInAppRole(this ClaimsPrincipal claimsPrincipal, string role) - { - var roles = claimsPrincipal.Claims.Where(x => x.Type == "roles").Select(x => x.Value); - - return roles.Contains(role); - } + private static bool IsInAppRole(this ClaimsPrincipal claimsPrincipal, string role) => claimsPrincipal.Claims.Where(x => x.Type == "roles").Select(x => x.Value).Contains(role); public static bool HasIssueCertificateRole(this ClaimsPrincipal claimsPrincipal) => !IsAppRoleRequired || claimsPrincipal.IsInAppRole(IssueCertificateAppRole); diff --git a/KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs b/KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs index 21e8fa4a..f4771e0c 100644 --- a/KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs +++ b/KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs @@ -16,8 +16,5 @@ public ApplicationVersionInitializer() public string ApplicationVersion { get; } - public void Initialize(ITelemetry telemetry) - { - telemetry.Context.Component.Version = ApplicationVersion; - } + public void Initialize(ITelemetry telemetry) => telemetry.Context.Component.Version = ApplicationVersion; } diff --git a/KeyVault.Acmebot/KeyVault.Acmebot.csproj b/KeyVault.Acmebot/KeyVault.Acmebot.csproj index b54d3e90..f9810d1d 100644 --- a/KeyVault.Acmebot/KeyVault.Acmebot.csproj +++ b/KeyVault.Acmebot/KeyVault.Acmebot.csproj @@ -4,8 +4,8 @@ v4 - - + + diff --git a/KeyVault.Acmebot/Providers/GoDaddyProvider.cs b/KeyVault.Acmebot/Providers/GoDaddyProvider.cs index 96173103..273a5f1d 100644 --- a/KeyVault.Acmebot/Providers/GoDaddyProvider.cs +++ b/KeyVault.Acmebot/Providers/GoDaddyProvider.cs @@ -81,7 +81,8 @@ public GoDaddyClient(string apiKey, string apiSecret) public async Task> ListZonesAsync() { - var limit = 100; + const int limit = 100; + var marker = ""; var allActiveDomains = new List();