Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading dependencies to .NET 8 #15

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -12,8 +13,10 @@
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<TrimmerSingleWarn>true</TrimmerSingleWarn>
<LangVersion>12.0</LangVersion>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

<ItemGroup>
<TrimmerRootDescriptor Include="../../linker.xml" />
</ItemGroup>
Expand All @@ -36,19 +39,18 @@
<RepositoryUrl>https://github.com/ellosoft/aws-cred-mgr</RepositoryUrl>
<PackageProjectUrl>https://github.com/ellosoft/aws-cred-mgr</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<Version>0.0.1-alpha-4</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.0.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.0.6" />
<PackageReference Include="AWSSDK.RDS" Version="3.7.213.1" />
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.202.15" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.2.23479.6" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0-rc.2.23479.6" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="AWSSDK.RDS" Version="3.7.300.2" />
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.300.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0-rc.2.23479.6" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
<PackageReference Include="Spectre.Console.Analyzer" Version="0.47.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GitHubRelease
public bool PreRelease { get; set; }

[JsonPropertyName("assets")]
public ICollection<ReleaseAsset> Assets { get; set; } = Array.Empty<ReleaseAsset>();
public ICollection<ReleaseAsset> Assets { get; set; } = [];

public class ReleaseAsset
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Check warning on line 17 in src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs

View workflow job for this annotation

GitHub Actions / build

Remove the member initializer, all constructors set an initial value for the member. (https://rules.sonarsource.com/csharp/RSPEC-3604)

Check warning on line 17 in src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs

View workflow job for this annotation

GitHub Actions / build

Remove the member initializer, all constructors set an initial value for the member. (https://rules.sonarsource.com/csharp/RSPEC-3604)
private readonly AwsSamlService _awsSamlService = new();

Check warning on line 18 in src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs

View workflow job for this annotation

GitHub Actions / build

Remove the member initializer, all constructors set an initial value for the member. (https://rules.sonarsource.com/csharp/RSPEC-3604)

Check warning on line 18 in src/Ellosoft.AwsCredentialsManager/Services/AWS/Interactive/AwsOktaSessionManager.cs

View workflow job for this annotation

GitHub Actions / build

Remove the member initializer, all constructors set an initial value for the member. (https://rules.sonarsource.com/csharp/RSPEC-3604)

public AwsOktaSessionManager(
CredentialsManager credentialsManager,
IOktaLoginService loginService,
OktaSamlService oktaSamlService)
{
_credentialsManager = credentialsManager;
_oktaLoginService = loginService;
_oktaSamlService = oktaSamlService;
}

public async Task<AWSCredentials?> 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;
Expand Down Expand Up @@ -71,12 +60,12 @@

private async Task<AwsCredentialsData?> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public class RdsTokenGenerator
/// <param name="hostname">Hostname of the RDS instance.</param>
/// <param name="port">Port number of the RDS instance.</param>
/// <param name="dbUser">Database user to authenticate.</param>
/// <param name="ttlInMinutes">RDS password lifetime (recommended 15 minutes)</param>
/// <param name="ttlInMinutes">RDS password lifetime (max 15 minutes)</param>
/// <returns>RDS DB password</returns>
/// <remarks>
/// This method is based on the <see cref="RDSAuthTokenGenerator" />,
/// 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.
/// </remarks>
public string GenerateDbPassword(
AWSCredentials awsCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public class AuthenticationResponse

public class AuthenticationResponseDetails
{
public IList<OktaFactor> Factors { get; set; } = Array.Empty<OktaFactor>();
public IList<OktaFactor> Factors { get; set; } = [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class OktaApiError

public string? ErrorId { get; set; }

public ErrorCause[] ErrorCauses { get; set; } = Array.Empty<ErrorCause>();
public ErrorCause[] ErrorCauses { get; set; } = [];

public class ErrorCause
{
Expand Down