Skip to content

Mark StsCredentialsProvider and StsCredentialsProvider.Builder as public. #4045

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

Merged
merged 1 commit into from
May 26, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Optional;
import java.util.function.Function;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
Expand All @@ -46,8 +46,8 @@
* Users of this provider must {@link #close()} it when they are finished using it.
*/
@ThreadSafe
@SdkInternalApi
abstract class StsCredentialsProvider implements AwsCredentialsProvider, SdkAutoCloseable {
@SdkPublicApi
public abstract class StsCredentialsProvider implements AwsCredentialsProvider, SdkAutoCloseable {

private static final Duration DEFAULT_STALE_TIME = Duration.ofMinutes(1);
private static final Duration DEFAULT_PREFETCH_TIME = Duration.ofMinutes(5);
Expand All @@ -66,7 +66,7 @@ abstract class StsCredentialsProvider implements AwsCredentialsProvider, SdkAuto
private final Duration prefetchTime;
private final Boolean asyncCredentialUpdateEnabled;

protected StsCredentialsProvider(BaseBuilder<?, ?> builder, String asyncThreadName) {
StsCredentialsProvider(BaseBuilder<?, ?> builder, String asyncThreadName) {
this.stsClient = Validate.notNull(builder.stsClient, "STS client must not be null.");

this.staleTime = Optional.ofNullable(builder.staleTime).orElse(DEFAULT_STALE_TIME);
Expand Down Expand Up @@ -123,13 +123,14 @@ public Duration prefetchTime() {
/**
* Implemented by a child class to call STS and get a new set of credentials to be used by this provider.
*/
protected abstract Credentials getUpdatedCredentials(StsClient stsClient);
abstract Credentials getUpdatedCredentials(StsClient stsClient);

/**
* Extended by child class's builders to share configuration across credential providers.
*/
@NotThreadSafe
protected abstract static class BaseBuilder<B extends BaseBuilder<B, T>, T extends ToCopyableBuilder<B, T>>
@SdkPublicApi
public abstract static class BaseBuilder<B extends BaseBuilder<B, T>, T extends ToCopyableBuilder<B, T>>
implements CopyableBuilder<B, T> {
private final Function<B, T> providerConstructor;

Expand All @@ -138,11 +139,11 @@ protected abstract static class BaseBuilder<B extends BaseBuilder<B, T>, T exten
private Duration staleTime;
private Duration prefetchTime;

protected BaseBuilder(Function<B, T> providerConstructor) {
BaseBuilder(Function<B, T> providerConstructor) {
this.providerConstructor = providerConstructor;
}

public BaseBuilder(Function<B, T> providerConstructor, StsCredentialsProvider provider) {
BaseBuilder(Function<B, T> providerConstructor, StsCredentialsProvider provider) {
this.providerConstructor = providerConstructor;
this.asyncCredentialUpdateEnabled = provider.asyncCredentialUpdateEnabled;
this.stsClient = provider.stsClient;
Expand Down