Skip to content

Commit

Permalink
chore: add logging around credentials provider
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudshiftchris committed Jan 23, 2025
1 parent 02c979a commit 28022b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description=CodeArtifact settings plugin for Gradle
kotlin.code.style=official

group=io.cloudshiftdev.codeartifact
version=1.0.6
version=1.0.7

org.gradle.jvmargs=-Dfile.encoding\=UTF-8
org.gradle.vfs.watch=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ internal object CodeArtifactOperations {
private fun buildCredentialsProvider(
queryParameters: Map<String, String>
): CredentialsProvider {
fun mask(value: String): String =
fun mask(value: String?): String? =
when {
value == null -> null
value.length > 4 -> value.take(4) + "*".repeat(value.length - 4)
else -> value
}
Expand Down Expand Up @@ -148,10 +149,10 @@ internal object CodeArtifactOperations {

val bootstrapProviders = CredentialsProviderChain(providers)
val stsRoleArnKey = "codeartifact.stsRoleArn"

val assumeRoleArn = resolveSystemVar(stsRoleArnKey)
logger.info("Assume role arn to get CodeArtifact token: {}", mask(assumeRoleArn))
val provider =
resolveSystemVar(stsRoleArnKey)?.let { roleArn ->
logger.info("Assume role to get CodeArtifact token: {}", mask(roleArn))
assumeRoleArn?.let { roleArn ->
StsAssumeRoleCredentialsProvider(
bootstrapCredentialsProvider = bootstrapProviders,
assumeRoleParameters =
Expand Down

0 comments on commit 28022b7

Please sign in to comment.