Skip to content

Commit 7a8eff5

Browse files
authored
Rename IdentityProviderUpdater to RequestIdentityProviderResolver (#7091)
* Rename IdentityProviderUpdater to RequestIdentityProviderResolver
1 parent 3b01dab commit 7a8eff5

7 files changed

Lines changed: 40 additions & 40 deletions

File tree

core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/AwsExecutionContextBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import software.amazon.awssdk.awscore.client.config.AwsClientOption;
3636
import software.amazon.awssdk.awscore.internal.authcontext.AuthorizationStrategy;
3737
import software.amazon.awssdk.awscore.internal.authcontext.AuthorizationStrategyFactory;
38-
import software.amazon.awssdk.awscore.internal.identity.AwsIdentityProviderUpdater;
38+
import software.amazon.awssdk.awscore.internal.identity.AwsRequestIdentityProviderResolver;
3939
import software.amazon.awssdk.awscore.util.SignerOverrideUtils;
4040
import software.amazon.awssdk.core.HttpChecksumConstant;
4141
import software.amazon.awssdk.core.RequestOverrideConfiguration;
@@ -159,9 +159,9 @@ private AwsExecutionContextBuilder() {
159159
executionParams.endpointResolver());
160160
}
161161

162-
// Set the identity provider updater for the pipeline stage to use
163-
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_UPDATER,
164-
AwsIdentityProviderUpdater.create());
162+
// Set the identity provider resolver for the pipeline stage to use
163+
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_RESOLVER,
164+
AwsRequestIdentityProviderResolver.create());
165165

166166
ExecutionInterceptorChain executionInterceptorChain =
167167
new ExecutionInterceptorChain(clientConfig.option(SdkClientOption.EXECUTION_INTERCEPTORS));

core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/identity/AwsIdentityProviderUpdater.java renamed to core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/identity/AwsRequestIdentityProviderResolver.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@
2222
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
2323
import software.amazon.awssdk.core.SdkRequest;
2424
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
25-
import software.amazon.awssdk.core.spi.identity.IdentityProviderUpdater;
25+
import software.amazon.awssdk.core.spi.identity.RequestIdentityProviderResolver;
2626
import software.amazon.awssdk.identity.spi.IdentityProviders;
2727

2828
/**
29-
* AWS implementation of {@link IdentityProviderUpdater} that reads credential overrides
29+
* AWS implementation of {@link RequestIdentityProviderResolver} that reads credential overrides
3030
* from {@link AwsRequestOverrideConfiguration} and deprecated {@link AwsSignerExecutionAttribute#AWS_CREDENTIALS}.
3131
*/
3232
@SdkInternalApi
33-
public final class AwsIdentityProviderUpdater implements IdentityProviderUpdater {
33+
public final class AwsRequestIdentityProviderResolver implements RequestIdentityProviderResolver {
3434

35-
private static final AwsIdentityProviderUpdater INSTANCE = new AwsIdentityProviderUpdater();
35+
private static final AwsRequestIdentityProviderResolver INSTANCE = new AwsRequestIdentityProviderResolver();
3636

37-
private AwsIdentityProviderUpdater() {
37+
private AwsRequestIdentityProviderResolver() {
3838
}
3939

40-
public static AwsIdentityProviderUpdater create() {
40+
public static AwsRequestIdentityProviderResolver create() {
4141
return INSTANCE;
4242
}
4343

4444
@Override
45-
public IdentityProviders update(SdkRequest request, IdentityProviders base, ExecutionAttributes executionAttributes) {
45+
public IdentityProviders resolve(SdkRequest request, IdentityProviders base, ExecutionAttributes executionAttributes) {
4646
if (base == null) {
4747
return null;
4848
}
4949

50-
IdentityProviders updated = request.overrideConfiguration()
50+
IdentityProviders resolvedProviders = request.overrideConfiguration()
5151
.filter(c -> c instanceof AwsRequestOverrideConfiguration)
5252
.map(c -> (AwsRequestOverrideConfiguration) c)
5353
.map(c -> base.copy(b -> {
@@ -56,8 +56,8 @@ public IdentityProviders update(SdkRequest request, IdentityProviders base, Exec
5656
}))
5757
.orElse(null);
5858

59-
if (updated != null) {
60-
return updated;
59+
if (resolvedProviders != null) {
60+
return resolvedProviders;
6161
}
6262

6363
// Support deprecated AWS_CREDENTIALS execution attribute for backwards compatibility

core/sdk-core/src/main/java/software/amazon/awssdk/core/http/auth/AuthSchemeResolver.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import software.amazon.awssdk.core.internal.util.MetricUtils;
3333
import software.amazon.awssdk.core.metrics.CoreMetric;
3434
import software.amazon.awssdk.core.spi.identity.AuthSchemeOptionsResolver;
35-
import software.amazon.awssdk.core.spi.identity.IdentityProviderUpdater;
35+
import software.amazon.awssdk.core.spi.identity.RequestIdentityProviderResolver;
3636
import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme;
3737
import software.amazon.awssdk.http.auth.spi.scheme.AuthSchemeOption;
3838
import software.amazon.awssdk.http.auth.spi.signer.HttpSigner;
@@ -76,10 +76,10 @@ public static SelectedAuthScheme<? extends Identity> resolveAuthScheme(
7676
IdentityProviders identityProviders =
7777
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDERS);
7878

79-
IdentityProviderUpdater updater =
80-
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_UPDATER);
81-
if (updater != null) {
82-
identityProviders = updater.update(request, identityProviders, executionAttributes);
79+
RequestIdentityProviderResolver resolver =
80+
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_RESOLVER);
81+
if (resolver != null) {
82+
identityProviders = resolver.resolve(request, identityProviders, executionAttributes);
8383
}
8484

8585
List<AuthSchemeOption> authOptions = optionsResolver.resolve(request);

core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/SdkInternalExecutionAttribute.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import software.amazon.awssdk.core.internal.endpoint.EndpointResolver;
3434
import software.amazon.awssdk.core.internal.interceptor.trait.RequestCompression;
3535
import software.amazon.awssdk.core.spi.identity.AuthSchemeOptionsResolver;
36-
import software.amazon.awssdk.core.spi.identity.IdentityProviderUpdater;
36+
import software.amazon.awssdk.core.spi.identity.RequestIdentityProviderResolver;
3737
import software.amazon.awssdk.core.useragent.AdditionalMetadata;
3838
import software.amazon.awssdk.core.useragent.BusinessMetricCollection;
3939
import software.amazon.awssdk.endpoints.Endpoint;
@@ -175,8 +175,8 @@ public final class SdkInternalExecutionAttribute extends SdkExecutionAttribute {
175175
* Callback for updating identity providers based on request-level overrides.
176176
* This allows aws-core to provide AWS-specific logic without sdk-core depending on aws-core.
177177
*/
178-
public static final ExecutionAttribute<IdentityProviderUpdater> IDENTITY_PROVIDER_UPDATER =
179-
new ExecutionAttribute<>("IdentityProviderUpdater");
178+
public static final ExecutionAttribute<RequestIdentityProviderResolver> IDENTITY_PROVIDER_RESOLVER =
179+
new ExecutionAttribute<>("RequestIdentityProviderResolver");
180180

181181
/**
182182
* Callback to resolve auth scheme options from the (possibly modified) request.

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/http/pipeline/stages/AuthSchemeResolutionStage.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import software.amazon.awssdk.core.internal.http.RequestExecutionContext;
3232
import software.amazon.awssdk.core.internal.http.pipeline.MutableRequestToRequestPipeline;
3333
import software.amazon.awssdk.core.spi.identity.AuthSchemeOptionsResolver;
34-
import software.amazon.awssdk.core.spi.identity.IdentityProviderUpdater;
34+
import software.amazon.awssdk.core.spi.identity.RequestIdentityProviderResolver;
3535
import software.amazon.awssdk.core.useragent.BusinessMetricCollection;
3636
import software.amazon.awssdk.core.useragent.BusinessMetricFeatureId;
3737
import software.amazon.awssdk.http.SdkHttpFullRequest;
@@ -120,17 +120,17 @@ private List<AuthSchemeOption> resolveAuthSchemeOptions(ExecutionAttributes exec
120120
/**
121121
* Returns identity providers after applying any request-level overrides. This allows aws-core to inject
122122
* credential overrides from {@code AwsRequestOverrideConfiguration} (e.g., per-request credentials provider)
123-
* without sdk-core depending on aws-core. The updater is set by {@code AwsExecutionContextBuilder} and runs
123+
* without sdk-core depending on aws-core. The resolver is set by {@code AwsExecutionContextBuilder} and runs
124124
* after interceptors have modified the request, ensuring user-injected credentials are respected.
125125
*/
126126
private IdentityProviders updateIdentityProvidersIfNeeded(ExecutionAttributes executionAttributes, SdkRequest request) {
127127
IdentityProviders identityProviders =
128128
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDERS);
129129

130-
IdentityProviderUpdater updater =
131-
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_UPDATER);
132-
if (updater != null) {
133-
identityProviders = updater.update(request, identityProviders, executionAttributes);
130+
RequestIdentityProviderResolver resolver =
131+
executionAttributes.getAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_RESOLVER);
132+
if (resolver != null) {
133+
identityProviders = resolver.resolve(request, identityProviders, executionAttributes);
134134
}
135135
return identityProviders;
136136
}

core/sdk-core/src/main/java/software/amazon/awssdk/core/spi/identity/IdentityProviderUpdater.java renamed to core/sdk-core/src/main/java/software/amazon/awssdk/core/spi/identity/RequestIdentityProviderResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@
2121
import software.amazon.awssdk.identity.spi.IdentityProviders;
2222

2323
/**
24-
* Callback interface for updating identity providers based on request-level overrides.
24+
* Callback interface for resolving the final identity providers considering request-level overrides.
2525
* <p>
2626
* This allows aws-core to provide AWS-specific logic for reading credential overrides
2727
* from {@code AwsRequestOverrideConfiguration} without sdk-core depending on aws-core.
2828
*/
2929
@FunctionalInterface
3030
@SdkProtectedApi
31-
public interface IdentityProviderUpdater {
31+
public interface RequestIdentityProviderResolver {
3232
/**
33-
* Updates identity providers by applying request-level credential overrides or
33+
* Resolves identity providers by applying request-level credential overrides or
3434
* credentials set via {@code AwsSignerExecutionAttribute.AWS_CREDENTIALS} by interceptors.
3535
*
3636
* @param request The request (after interceptors have modified it)
3737
* @param base The base identity providers from client configuration
3838
* @param executionAttributes The execution attributes, checked for interceptor-set AWS_CREDENTIALS
3939
* @return Updated identity providers, or base if no overrides apply
4040
*/
41-
IdentityProviders update(SdkRequest request, IdentityProviders base, ExecutionAttributes executionAttributes);
41+
IdentityProviders resolve(SdkRequest request, IdentityProviders base, ExecutionAttributes executionAttributes);
4242
}

core/sdk-core/src/test/java/software/amazon/awssdk/core/internal/http/pipeline/stages/AuthSchemeResolutionStageTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute;
3737
import software.amazon.awssdk.core.internal.http.RequestExecutionContext;
3838
import software.amazon.awssdk.core.spi.identity.AuthSchemeOptionsResolver;
39-
import software.amazon.awssdk.core.spi.identity.IdentityProviderUpdater;
39+
import software.amazon.awssdk.core.spi.identity.RequestIdentityProviderResolver;
4040
import software.amazon.awssdk.http.SdkHttpFullRequest;
4141
import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme;
4242
import software.amazon.awssdk.http.auth.spi.scheme.AuthSchemeOption;
@@ -139,15 +139,15 @@ void execute_resolverReceivesRequestFromInterceptorContext() throws Exception {
139139
}
140140

141141
@Test
142-
void execute_withIdentityProviderUpdater_callsUpdaterWithRequest() throws Exception {
142+
void execute_withRequestIdentityProviderResolver_callsUpdaterWithRequest() throws Exception {
143143
// Create mocks first before any stubbing
144144
IdentityProvider<Identity> identityProvider = createMockIdentityProvider();
145145
Map<String, AuthScheme<?>> authSchemes = createAuthSchemes();
146146
IdentityProviders baseProviders = mock(IdentityProviders.class);
147147
IdentityProviders updatedProviders = mock(IdentityProviders.class);
148148

149-
IdentityProviderUpdater updater = mock(IdentityProviderUpdater.class);
150-
doReturn(updatedProviders).when(updater).update(sdkRequest, baseProviders, executionAttributes);
149+
RequestIdentityProviderResolver resolver = mock(RequestIdentityProviderResolver.class);
150+
doReturn(updatedProviders).when(resolver).resolve(sdkRequest, baseProviders, executionAttributes);
151151

152152
// Setup so that auth scheme uses the updated providers
153153
@SuppressWarnings("unchecked")
@@ -158,20 +158,20 @@ void execute_withIdentityProviderUpdater_callsUpdaterWithRequest() throws Except
158158
executionAttributes.putAttribute(SdkInternalExecutionAttribute.AUTH_SCHEME_OPTIONS_RESOLVER,
159159
(AuthSchemeOptionsResolver) req -> createAuthOptions());
160160
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDERS, baseProviders);
161-
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_UPDATER, updater);
161+
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDER_RESOLVER, resolver);
162162

163163
stage.execute(httpRequestBuilder, context);
164164

165-
verify(updater).update(sdkRequest, baseProviders, executionAttributes);
165+
verify(resolver).resolve(sdkRequest, baseProviders, executionAttributes);
166166
}
167167

168168
@Test
169-
void execute_withoutIdentityProviderUpdater_doesNotFail() throws Exception {
169+
void execute_withoutRequestIdentityProviderResolver_doesNotFail() throws Exception {
170170
executionAttributes.putAttribute(SdkInternalExecutionAttribute.AUTH_SCHEMES, createAuthSchemes());
171171
executionAttributes.putAttribute(SdkInternalExecutionAttribute.AUTH_SCHEME_OPTIONS_RESOLVER,
172172
(AuthSchemeOptionsResolver) req -> createAuthOptions());
173173
executionAttributes.putAttribute(SdkInternalExecutionAttribute.IDENTITY_PROVIDERS, createIdentityProviders());
174-
// No IDENTITY_PROVIDER_UPDATER set
174+
// No IDENTITY_PROVIDER_RESOLVER set
175175

176176
SdkHttpFullRequest.Builder result = stage.execute(httpRequestBuilder, context);
177177

0 commit comments

Comments
 (0)