@@ -7,15 +7,18 @@ import {
7
7
} from "@aws-sdk/middleware-host-header" ;
8
8
import { getLoggerPlugin } from "@aws-sdk/middleware-logger" ;
9
9
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection" ;
10
- import { resolveStsAuthConfig , StsAuthInputConfig , StsAuthResolvedConfig } from "@aws-sdk/middleware-sdk-sts" ;
11
10
import {
12
11
getUserAgentPlugin ,
13
12
resolveUserAgentConfig ,
14
13
UserAgentInputConfig ,
15
14
UserAgentResolvedConfig ,
16
15
} from "@aws-sdk/middleware-user-agent" ;
17
- import { Credentials as __Credentials } from "@aws-sdk/types" ;
18
16
import { RegionInputConfig , RegionResolvedConfig , resolveRegionConfig } from "@smithy/config-resolver" ;
17
+ import {
18
+ DefaultIdentityProviderConfig ,
19
+ getHttpAuthSchemeEndpointRuleSetPlugin ,
20
+ getHttpSigningPlugin ,
21
+ } from "@smithy/core" ;
19
22
import { getContentLengthPlugin } from "@smithy/middleware-content-length" ;
20
23
import { EndpointInputConfig , EndpointResolvedConfig , resolveEndpointConfig } from "@smithy/middleware-endpoint" ;
21
24
import { getRetryPlugin , resolveRetryConfig , RetryInputConfig , RetryResolvedConfig } from "@smithy/middleware-retry" ;
@@ -27,6 +30,7 @@ import {
27
30
SmithyResolvedConfiguration as __SmithyResolvedConfiguration ,
28
31
} from "@smithy/smithy-client" ;
29
32
import {
33
+ AwsCredentialIdentityProvider ,
30
34
BodyLengthCalculator as __BodyLengthCalculator ,
31
35
CheckOptionalClientConfig as __CheckOptionalClientConfig ,
32
36
ChecksumConstructor as __ChecksumConstructor ,
@@ -43,6 +47,12 @@ import {
43
47
UserAgent as __UserAgent ,
44
48
} from "@smithy/types" ;
45
49
50
+ import {
51
+ defaultSTSHttpAuthSchemeParametersProvider ,
52
+ HttpAuthSchemeInputConfig ,
53
+ HttpAuthSchemeResolvedConfig ,
54
+ resolveHttpAuthSchemeConfig ,
55
+ } from "./auth/httpAuthSchemeProvider" ;
46
56
import { AssumeRoleCommandInput , AssumeRoleCommandOutput } from "./commands/AssumeRoleCommand" ;
47
57
import { AssumeRoleWithSAMLCommandInput , AssumeRoleWithSAMLCommandOutput } from "./commands/AssumeRoleWithSAMLCommand" ;
48
58
import {
@@ -181,21 +191,22 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
181
191
useFipsEndpoint ?: boolean | __Provider < boolean > ;
182
192
183
193
/**
184
- * The AWS region to which this client will send requests
194
+ * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
195
+ * @internal
185
196
*/
186
- region ?: string | __Provider < string > ;
197
+ defaultUserAgentProvider ?: Provider < __UserAgent > ;
187
198
188
199
/**
189
- * Default credentials provider; Not available in browser runtime.
190
- * @internal
200
+ * The AWS region to which this client will send requests
191
201
*/
192
- credentialDefaultProvider ?: ( input : any ) => __Provider < __Credentials > ;
202
+ region ?: string | __Provider < string > ;
193
203
194
204
/**
195
- * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
205
+ * Default credentials provider; Not available in browser runtime.
206
+ * @deprecated
196
207
* @internal
197
208
*/
198
- defaultUserAgentProvider ?: Provider < __UserAgent > ;
209
+ credentialDefaultProvider ?: ( input : any ) => AwsCredentialIdentityProvider ;
199
210
200
211
/**
201
212
* Value for how many times a request will be made at most in case of retry.
@@ -234,8 +245,8 @@ export type STSClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOpt
234
245
EndpointInputConfig < EndpointParameters > &
235
246
RetryInputConfig &
236
247
HostHeaderInputConfig &
237
- StsAuthInputConfig &
238
248
UserAgentInputConfig &
249
+ HttpAuthSchemeInputConfig &
239
250
ClientInputEndpointParameters ;
240
251
/**
241
252
* @public
@@ -254,8 +265,8 @@ export type STSClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHa
254
265
EndpointResolvedConfig < EndpointParameters > &
255
266
RetryResolvedConfig &
256
267
HostHeaderResolvedConfig &
257
- StsAuthResolvedConfig &
258
268
UserAgentResolvedConfig &
269
+ HttpAuthSchemeResolvedConfig &
259
270
ClientResolvedEndpointParameters ;
260
271
/**
261
272
* @public
@@ -282,15 +293,26 @@ export class STSClient extends __Client<
282
293
*/
283
294
readonly config : STSClientResolvedConfig ;
284
295
296
+ private getDefaultHttpAuthSchemeParametersProvider ( ) {
297
+ return defaultSTSHttpAuthSchemeParametersProvider ;
298
+ }
299
+
300
+ private getIdentityProviderConfigProvider ( ) {
301
+ return async ( config : STSClientResolvedConfig ) =>
302
+ new DefaultIdentityProviderConfig ( {
303
+ "aws.auth#sigv4" : config . credentials ,
304
+ } ) ;
305
+ }
306
+
285
307
constructor ( ...[ configuration ] : __CheckOptionalClientConfig < STSClientConfig > ) {
286
308
const _config_0 = __getRuntimeConfig ( configuration || { } ) ;
287
309
const _config_1 = resolveClientEndpointParameters ( _config_0 ) ;
288
310
const _config_2 = resolveRegionConfig ( _config_1 ) ;
289
311
const _config_3 = resolveEndpointConfig ( _config_2 ) ;
290
312
const _config_4 = resolveRetryConfig ( _config_3 ) ;
291
313
const _config_5 = resolveHostHeaderConfig ( _config_4 ) ;
292
- const _config_6 = resolveStsAuthConfig ( _config_5 , { stsClientCtor : STSClient } ) ;
293
- const _config_7 = resolveUserAgentConfig ( _config_6 ) ;
314
+ const _config_6 = resolveUserAgentConfig ( _config_5 ) ;
315
+ const _config_7 = resolveHttpAuthSchemeConfig ( _config_6 ) ;
294
316
const _config_8 = resolveRuntimeExtensions ( _config_7 , configuration ?. extensions || [ ] ) ;
295
317
super ( _config_8 ) ;
296
318
this . config = _config_8 ;
@@ -300,6 +322,13 @@ export class STSClient extends __Client<
300
322
this . middlewareStack . use ( getLoggerPlugin ( this . config ) ) ;
301
323
this . middlewareStack . use ( getRecursionDetectionPlugin ( this . config ) ) ;
302
324
this . middlewareStack . use ( getUserAgentPlugin ( this . config ) ) ;
325
+ this . middlewareStack . use (
326
+ getHttpAuthSchemeEndpointRuleSetPlugin ( this . config , {
327
+ httpAuthSchemeParametersProvider : this . getDefaultHttpAuthSchemeParametersProvider ( ) ,
328
+ identityProviderConfigProvider : this . getIdentityProviderConfigProvider ( ) ,
329
+ } )
330
+ ) ;
331
+ this . middlewareStack . use ( getHttpSigningPlugin ( this . config ) ) ;
303
332
}
304
333
305
334
/**
0 commit comments