Skip to content

Commit

Permalink
Merge branch 'release/2.19.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 20, 2024
2 parents e0300f0 + 770bc57 commit 24826c5
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 9 deletions.
31 changes: 29 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [2.19.1](https://github.com/Terradue/Stars/compare/2.19.0...2.19.1)
## [2.19.4](https://github.com/Terradue/Stars/compare/2.19.3...2.19.4)

***Add SessionToken property to S3Options

### Commits

- Fix GetWebIdentityCredentialsAsync parameter name in IS3ClientFactory [`d7ab7f5`](https://github.com/Terradue/Stars/commit/d7ab7f56d7b1da1f9f324dcc17aa46c3041cd001)
- Fix S3ClientFactory to handle session tokens*** [`a153fff`](https://github.com/Terradue/Stars/commit/a153fffae307684bc281c45187a59f4e21c80a8f)

## [2.19.3](https://github.com/Terradue/Stars/compare/2.19.2...2.19.3) - 2024-02-19

### Commits

- Add support for t2:product_type in OpenSearchableSupplier [`1a1ae75`](https://github.com/Terradue/Stars/commit/1a1ae7538b82b31d5be745963156044735c57d83)
- Ready to release 2.19.3 [`9e3cd4e`](https://github.com/Terradue/Stars/commit/9e3cd4e69550f88e5d6ff28f03c7a24c8a864bff)

## [2.19.2](https://github.com/Terradue/Stars/compare/2.19.1-1...2.19.2) - 2024-02-19

### Merged

- Fix for NullReferenceException (BKA) [`#44`](https://github.com/Terradue/Stars/pull/44)

### Commits

- Fix for NullReferenceException [`849efe5`](https://github.com/Terradue/Stars/commit/849efe5e12cc43e386ce8529c5a514a32a816f99)
- Ready to release 2.19.2 [`470ef9b`](https://github.com/Terradue/Stars/commit/470ef9b4e77e6d0785a939c45c52208bcc69c181)

## [2.19.1-1](https://github.com/Terradue/Stars/compare/2.19.0...2.19.1-1) - 2024-02-13

### Commits

- Update file sizes in metadata JSON [`3fd6f4b`](https://github.com/Terradue/Stars/commit/3fd6f4b3086125af5c97083694c0a07c6137533d)
- Add S3 copy launch configuration and update S3ClientFactory [`72d9c46`](https://github.com/Terradue/Stars/commit/72d9c46e32b6e8ff65f76cf2c6c07a60e6593b2a)
- Add CONAE/SAOCOM-1 resources to .gitignore [`a347df7`](https://github.com/Terradue/Stars/commit/a347df70494a2d4b9b1ae52a37e52e7f88baf214)
- RTR 2.19.1 [`7ce4e26`](https://github.com/Terradue/Stars/commit/7ce4e261b2f6bd22893200b844ac8be46dce656d)

## [2.19.0](https://github.com/Terradue/Stars/compare/2.18.1...2.19.0) - 2024-02-09

Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Console/Terradue.Stars.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<Version>2.19.3</Version>
<Version>2.19.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Description>Stars is a CLI for working with Spatio Temporal Catalog such as STAC but not only</Description>
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Data/Terradue.Stars.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ProjectName>Terradue.Stars.Data</ProjectName>
<Title>Terradue.Stars.Data</Title>
<Description>Collection of data Plugins for Terradue.Stars</Description>
<Version>2.19.3</Version>
<Version>2.19.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<NoWarn>NU1603</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Services/Resources/IS3ClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface IS3ClientFactory
Task<IAmazonS3> CreateS3ClientAsync(S3Url url, IIdentityProvider identityProvider, string policy = null);
AWSCredentials GetConfiguredCredentials(S3Url s3Url, IIdentityProvider identityProvider = null);
IAmazonS3 CreateS3Client(string name);
Task<AWSCredentials> GetWebIdentityCredentialsAsync(string url, JwtSecurityToken jwt, string policy);
Task<AWSCredentials> GetWebIdentityCredentialsAsync(string serviceUrl, JwtSecurityToken jwt, string policy);


}
Expand Down
17 changes: 14 additions & 3 deletions src/Stars.Services/Resources/S3ClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ public AWSCredentials GetConfiguredCredentials(S3Url s3Url, IIdentityProvider id
{
var s3Configuration = s3Options.CurrentValue.GetS3Configuration(s3Url.ToString(), identityProvider?.GetPrincipal());

if (!string.IsNullOrEmpty(s3Configuration.Value?.AccessKey) != null && !string.IsNullOrEmpty(s3Configuration.Value?.SecretKey))
if (!string.IsNullOrEmpty(s3Configuration.Value?.AccessKey) && !string.IsNullOrEmpty(s3Configuration.Value?.SecretKey))
{
if ( !string.IsNullOrEmpty(s3Configuration.Value?.SessionToken))
{
return new SessionAWSCredentials(s3Configuration.Value.AccessKey, s3Configuration.Value.SecretKey, s3Configuration.Value.SessionToken);
}
return new BasicAWSCredentials(s3Configuration.Value.AccessKey, s3Configuration.Value.SecretKey);
}

Expand Down Expand Up @@ -367,9 +371,16 @@ public AWSOptions GetNamedAWSOptionsOrDefault(string key)
return s3Options.CurrentValue.RootConfiguration.GetAWSOptions();
}


public async Task<AWSCredentials> GetWebIdentityCredentialsAsync(string serviceURL, JwtSecurityToken jwt, string policy)
{
if (jwt == null)
{
throw new ArgumentNullException(nameof(jwt));
}
if (jwt.ValidTo < DateTime.UtcNow)
{
throw new ArgumentException("JWT token is expired");
}
AmazonSecurityTokenServiceConfig amazonSecurityTokenServiceConfig = new AmazonSecurityTokenServiceConfig();
amazonSecurityTokenServiceConfig.ServiceURL = serviceURL;
var stsClient = new AmazonSecurityTokenServiceClient(new AnonymousAWSCredentials(), amazonSecurityTokenServiceConfig);
Expand All @@ -379,7 +390,7 @@ public async Task<AWSCredentials> GetWebIdentityCredentialsAsync(string serviceU
WebIdentityToken = jwt.RawData,
// RoleArn = "arn:aws:iam::123456789012:role/RoleForTerradue",
RoleSessionName = "MySession",
DurationSeconds = 3600,
DurationSeconds = Math.Max(900, jwt.ValidTo.Subtract(DateTime.UtcNow).Seconds),
Policy = policy
});
return assumeRoleResult.Credentials;
Expand Down
2 changes: 2 additions & 0 deletions src/Stars.Services/Resources/S3Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public S3Configuration(S3Configuration s3Configuration)
this.ServiceURL = s3Configuration?.ServiceURL;
this.AccessKey = s3Configuration?.AccessKey;
this.SecretKey = s3Configuration?.SecretKey;
this.SessionToken = s3Configuration?.SessionToken;
this.AuthenticationRegion = s3Configuration?.AuthenticationRegion;
this.UseHttp = s3Configuration == null ? false : s3Configuration.UseHttp;
this.ForcePathStyle = s3Configuration == null ? false : s3Configuration.ForcePathStyle;
Expand All @@ -79,6 +80,7 @@ public S3Configuration(S3Configuration s3Configuration)
public string ServiceURL { get; set; }
public string AccessKey { get; set; }
public string SecretKey { get; set; }
public string SessionToken { get; set; }
public string Region { get; set; }
public string AuthenticationRegion { get; set; }
public bool UseHttp { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Services/Terradue.Stars.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Title>Terradue.Stars</Title>
<Description>Stars is a set of services for working with Spatio Temporal Catalog such as STAC but not only</Description>
<Version>2.19.3</Version>
<Version>2.19.4</Version>
<!-- <VersionSuffix>beta.8</VersionSuffix> -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<AssemblyName>Terradue.Stars.Services</AssemblyName>
Expand Down

0 comments on commit 24826c5

Please sign in to comment.