Skip to content

Commit 913f6c0

Browse files
committed
Add asyncCredentialUpdateEnabled getter in builder
1 parent ae5ff20 commit 913f6c0

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProvider.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ public Duration prefetchTime() {
131131
return prefetchTime;
132132
}
133133

134-
/**
135-
* Whether the provider should fetch credentials asynchronously in the background.
136-
* <p>By default, this is false.</p>
137-
*/
138-
public Boolean asyncCredentialUpdateEnabled() {
139-
return asyncCredentialUpdateEnabled;
140-
}
141-
142134
@Override
143135
public String toString() {
144136
return ToString.create(providerName());
@@ -238,5 +230,13 @@ public B prefetchTime(Duration prefetchTime) {
238230
public T build() {
239231
return providerConstructor.apply((B) this);
240232
}
233+
234+
/**
235+
* Whether the provider should fetch credentials asynchronously in the background.
236+
* <p>By default, this is false.</p>
237+
*/
238+
Boolean asyncCredentialUpdateEnabled() {
239+
return asyncCredentialUpdateEnabled;
240+
}
241241
}
242242
}

services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsWebIdentityTokenFileCredentialsProvider.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,18 @@ private StsWebIdentityTokenFileCredentialsProvider(Builder builder) {
107107
.webIdentityTokenFile(credentialProperties.webIdentityTokenFile())
108108
.build();
109109

110-
credentialsProviderLocal =
110+
StsAssumeRoleWithWebIdentityCredentialsProvider.Builder providerBuilder =
111111
StsAssumeRoleWithWebIdentityCredentialsProvider.builder()
112112
.stsClient(builder.stsClient)
113113
.refreshRequest(supplier)
114114
.staleTime(this.staleTime())
115-
.prefetchTime(this.prefetchTime())
116-
.asyncCredentialUpdateEnabled(this.asyncCredentialUpdateEnabled())
117-
.build();
115+
.prefetchTime(this.prefetchTime());
116+
117+
if (builder.asyncCredentialUpdateEnabled() != null) {
118+
providerBuilder.asyncCredentialUpdateEnabled(builder.asyncCredentialUpdateEnabled());
119+
}
120+
121+
credentialsProviderLocal = providerBuilder.build();
118122
} catch (RuntimeException e) {
119123
// If we couldn't load the credentials provider for some reason, save an exception describing why. This exception
120124
// will only be raised on calls to getCredentials. We don't want to raise an exception here because it may be

0 commit comments

Comments
 (0)