Skip to content

Commit

Permalink
Merge pull request #7 from mkdecisiondev/DEV-154903-assume-role
Browse files Browse the repository at this point in the history
Added ability to specify service-specific roles in the new assume role logic
  • Loading branch information
amiranjom authored Jun 27, 2023
2 parents 2e7dd2c + 551d08f commit 9d6b2aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/groovy/org/moqui/aws/S3ClientToolFactory.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class S3ClientToolFactory implements ToolFactory<S3Client> {
String awsRegion = SystemBinding.getPropOrEnv("AWS_REGION")
String awsAccessKeyId = SystemBinding.getPropOrEnv("AWS_ACCESS_KEY_ID")
String awsSecret = SystemBinding.getPropOrEnv("AWS_SECRET_ACCESS_KEY")
String awsRoleArn = SystemBinding.getPropOrEnv("AWS_ROLE_ARN")
String awsRoleArn = SystemBinding.getPropOrEnv("S3_AWS_ROLE_ARN") ?: SystemBinding.getPropOrEnv("AWS_ROLE_ARN")
String awsSessionToken = null

// Non standard AWS, for example Minio.
Expand All @@ -77,7 +77,7 @@ class S3ClientToolFactory implements ToolFactory<S3Client> {
// obtain credentials for the IAM role
Credentials sessionCredentials = stsClient.assumeRole(AssumeRoleRequest.builder()
.roleArn(awsRoleArn)
.roleSessionName("MoquiSnsClient")
.roleSessionName("MoquiS3Client")
.build() as AssumeRoleRequest
).credentials()

Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/org/moqui/aws/SnsClientToolFactory.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SnsClientToolFactory implements ToolFactory<SnsClient> {
String awsRegion = SystemBinding.getPropOrEnv("AWS_REGION")
String awsAccessKeyId = SystemBinding.getPropOrEnv("AWS_ACCESS_KEY_ID")
String awsSecret = SystemBinding.getPropOrEnv("AWS_SECRET_ACCESS_KEY")
String awsRoleArn = SystemBinding.getPropOrEnv("AWS_ROLE_ARN")
String awsRoleArn = SystemBinding.getPropOrEnv("SNS_AWS_ROLE_ARN") ?: SystemBinding.getPropOrEnv("AWS_ROLE_ARN")
String awsSessionToken = null

// Non standard AWS, for example Minio.
Expand Down

0 comments on commit 9d6b2aa

Please sign in to comment.