From 423abb01820960724ba334bab3c24cd0509f605f Mon Sep 17 00:00:00 2001 From: Vitor M <4777793+vgmello@users.noreply.github.com> Date: Wed, 15 Nov 2023 00:22:30 +0000 Subject: [PATCH] Upgrading dependencies to .NET 8 --- .github/workflows/build.yml | 1 - .github/workflows/release.yml | 1 - .../Ellosoft.AwsCredentialsManager.csproj | 20 ++++++++------- .../Upgrade/Models/GitHubRelease.cs | 2 +- .../AWS/Interactive/AwsOktaSessionManager.cs | 25 ++++++------------- .../Services/AWS/RDSTokenGenerator.cs | 4 +-- .../HttpModels/AuthenticationResponse.cs | 2 +- .../Okta/Models/HttpModels/OktaApiError.cs | 2 +- 8 files changed, 23 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49f64a6..f710f07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - dotnet-quality: "preview" - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a78c80..87573f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - dotnet-quality: "preview" - name: Restore dependencies run: dotnet restore - name: Build & Publish diff --git a/src/Ellosoft.AwsCredentialsManager/Ellosoft.AwsCredentialsManager.csproj b/src/Ellosoft.AwsCredentialsManager/Ellosoft.AwsCredentialsManager.csproj index 3629b39..be4722b 100644 --- a/src/Ellosoft.AwsCredentialsManager/Ellosoft.AwsCredentialsManager.csproj +++ b/src/Ellosoft.AwsCredentialsManager/Ellosoft.AwsCredentialsManager.csproj @@ -3,6 +3,7 @@ Exe net8.0 + AnyCPU @@ -12,8 +13,10 @@ true full true + 12.0 + false - + @@ -36,19 +39,18 @@ https://github.com/ellosoft/aws-cred-mgr https://github.com/ellosoft/aws-cred-mgr git - 0.0.1-alpha-4 - false + 0.0.1 - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Ellosoft.AwsCredentialsManager/Infrastructure/Upgrade/Models/GitHubRelease.cs b/src/Ellosoft.AwsCredentialsManager/Infrastructure/Upgrade/Models/GitHubRelease.cs index 480e060..18da383 100644 --- a/src/Ellosoft.AwsCredentialsManager/Infrastructure/Upgrade/Models/GitHubRelease.cs +++ b/src/Ellosoft.AwsCredentialsManager/Infrastructure/Upgrade/Models/GitHubRelease.cs @@ -16,7 +16,7 @@ public class GitHubRelease public bool PreRelease { get; set; } [JsonPropertyName("assets")] - public ICollection Assets { get; set; } = Array.Empty(); + public ICollection Assets { get; set; } = []; public class ReleaseAsset { diff --git a/src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs b/src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs index 6f7030f..7d495ce 100644 --- a/src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs +++ b/src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs @@ -9,28 +9,17 @@ namespace Ellosoft.AwsCredentialsManager.Services.AWS.Interactive; -public class AwsOktaSessionManager +public class AwsOktaSessionManager( + CredentialsManager credentialsManager, + IOktaLoginService loginService, + OktaSamlService oktaSamlService) { - private readonly CredentialsManager _credentialsManager; - private readonly IOktaLoginService _oktaLoginService; - private readonly OktaSamlService _oktaSamlService; - private readonly AwsCredentialsService _awsCredentialsService = new(); private readonly AwsSamlService _awsSamlService = new(); - public AwsOktaSessionManager( - CredentialsManager credentialsManager, - IOktaLoginService loginService, - OktaSamlService oktaSamlService) - { - _credentialsManager = credentialsManager; - _oktaLoginService = loginService; - _oktaSamlService = oktaSamlService; - } - public async Task CreateOrResumeSessionAsync(string credentialProfile, string? awsProfile) { - if (!_credentialsManager.TryGetCredential(credentialProfile, out var credentialsConfig)) + if (!credentialsManager.TryGetCredential(credentialProfile, out var credentialsConfig)) return null; var awsProfileName = awsProfile ?? credentialsConfig.AwsProfile; @@ -71,12 +60,12 @@ Do you want renew the credentials now ?[/] private async Task CreateSessionAsync(string credentialProfile, string awsProfileName, CredentialsConfiguration credentialsConfig) { - var authResult = await _oktaLoginService.InteractiveLogin(credentialsConfig.OktaProfile!); + var authResult = await loginService.InteractiveLogin(credentialsConfig.OktaProfile!); if (authResult?.SessionToken is null) return null; - var samlData = await _oktaSamlService.GetAppSamlDataAsync(authResult.OktaDomain, credentialsConfig.OktaAppUrl!, authResult.SessionToken); + var samlData = await oktaSamlService.GetAppSamlDataAsync(authResult.OktaDomain, credentialsConfig.OktaAppUrl!, authResult.SessionToken); var idp = GetRoleIdp(credentialProfile, credentialsConfig.RoleArn, samlData.SamlAssertion); diff --git a/src/Ellosoft.AwsCredentialsManager/Services/AWS/RDSTokenGenerator.cs b/src/Ellosoft.AwsCredentialsManager/Services/AWS/RDSTokenGenerator.cs index c470fed..bb5c06a 100644 --- a/src/Ellosoft.AwsCredentialsManager/Services/AWS/RDSTokenGenerator.cs +++ b/src/Ellosoft.AwsCredentialsManager/Services/AWS/RDSTokenGenerator.cs @@ -20,11 +20,11 @@ public class RdsTokenGenerator /// Hostname of the RDS instance. /// Port number of the RDS instance. /// Database user to authenticate. - /// RDS password lifetime (recommended 15 minutes) + /// RDS password lifetime (max 15 minutes) /// RDS DB password /// /// This method is based on the , - /// however it allows the DB password lifetime to be change from the hard code 15 minutes. + /// however it allows the DB password lifetime to be changed from the hard code 15 minutes. /// public string GenerateDbPassword( AWSCredentials awsCredentials, diff --git a/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/AuthenticationResponse.cs b/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/AuthenticationResponse.cs index 2a34642..1d8fc8d 100644 --- a/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/AuthenticationResponse.cs +++ b/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/AuthenticationResponse.cs @@ -22,6 +22,6 @@ public class AuthenticationResponse public class AuthenticationResponseDetails { - public IList Factors { get; set; } = Array.Empty(); + public IList Factors { get; set; } = []; } } diff --git a/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/OktaApiError.cs b/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/OktaApiError.cs index 9a0c9b9..2c0a41e 100644 --- a/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/OktaApiError.cs +++ b/src/Ellosoft.AwsCredentialsManager/Services/Okta/Models/HttpModels/OktaApiError.cs @@ -12,7 +12,7 @@ public class OktaApiError public string? ErrorId { get; set; } - public ErrorCause[] ErrorCauses { get; set; } = Array.Empty(); + public ErrorCause[] ErrorCauses { get; set; } = []; public class ErrorCause {