Skip to content

Commit

Permalink
Cleanup code and update packages (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibayan authored May 13, 2023
1 parent 552e761 commit f885190
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions KeyVault.Acmebot/Internal/AccountKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions KeyVault.Acmebot/Internal/AppRoleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 1 addition & 4 deletions KeyVault.Acmebot/Internal/ApplicationVersionInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions KeyVault.Acmebot/KeyVault.Acmebot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.Route53" Version="3.7.104.61" />
<PackageReference Include="Azure.Identity" Version="1.8.2" />
<PackageReference Include="AWSSDK.Route53" Version="3.7.104.68" />
<PackageReference Include="Azure.Identity" Version="1.9.0" />
<PackageReference Include="Azure.ResourceManager.Dns" Version="1.0.1" />
<PackageReference Include="Azure.ResourceManager.PrivateDns" Version="1.0.1" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.5.1" />
Expand Down
3 changes: 2 additions & 1 deletion KeyVault.Acmebot/Providers/GoDaddyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public GoDaddyClient(string apiKey, string apiSecret)

public async Task<IReadOnlyList<ZoneDomain>> ListZonesAsync()
{
var limit = 100;
const int limit = 100;

var marker = "";
var allActiveDomains = new List<ZoneDomain>();

Expand Down

0 comments on commit f885190

Please sign in to comment.