@@ -10,26 +10,26 @@ import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
10
10
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection" ;
11
11
import {
12
12
getRegionRedirectMiddlewarePlugin ,
13
+ getS3ExpressHttpSigningPlugin ,
13
14
getS3ExpressPlugin ,
14
15
getValidateBucketNamePlugin ,
15
16
resolveS3Config ,
16
17
S3InputConfig ,
17
18
S3ResolvedConfig ,
18
19
} from "@aws-sdk/middleware-sdk-s3" ;
19
- import {
20
- AwsAuthInputConfig ,
21
- AwsAuthResolvedConfig ,
22
- getAwsAuthPlugin ,
23
- resolveAwsAuthConfig ,
24
- } from "@aws-sdk/middleware-signing" ;
25
20
import {
26
21
getUserAgentPlugin ,
27
22
resolveUserAgentConfig ,
28
23
UserAgentInputConfig ,
29
24
UserAgentResolvedConfig ,
30
25
} from "@aws-sdk/middleware-user-agent" ;
31
- import { Credentials as __Credentials , GetAwsChunkedEncodingStream } from "@aws-sdk/types" ;
26
+ import { GetAwsChunkedEncodingStream } from "@aws-sdk/types" ;
32
27
import { RegionInputConfig , RegionResolvedConfig , resolveRegionConfig } from "@smithy/config-resolver" ;
28
+ import {
29
+ DefaultIdentityProviderConfig ,
30
+ getHttpAuthSchemeEndpointRuleSetPlugin ,
31
+ getHttpSigningPlugin ,
32
+ } from "@smithy/core" ;
33
33
import {
34
34
EventStreamSerdeInputConfig ,
35
35
EventStreamSerdeResolvedConfig ,
@@ -46,6 +46,7 @@ import {
46
46
SmithyResolvedConfiguration as __SmithyResolvedConfiguration ,
47
47
} from "@smithy/smithy-client" ;
48
48
import {
49
+ AwsCredentialIdentityProvider ,
49
50
BodyLengthCalculator as __BodyLengthCalculator ,
50
51
CheckOptionalClientConfig as __CheckOptionalClientConfig ,
51
52
Checksum as __Checksum ,
@@ -68,6 +69,12 @@ import {
68
69
} from "@smithy/types" ;
69
70
import { Readable } from "stream" ;
70
71
72
+ import {
73
+ defaultS3HttpAuthSchemeParametersProvider ,
74
+ HttpAuthSchemeInputConfig ,
75
+ HttpAuthSchemeResolvedConfig ,
76
+ resolveHttpAuthSchemeConfig ,
77
+ } from "./auth/httpAuthSchemeProvider" ;
71
78
import {
72
79
AbortMultipartUploadCommandInput ,
73
80
AbortMultipartUploadCommandOutput ,
@@ -663,19 +670,11 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
663
670
664
671
/**
665
672
* Default credentials provider; Not available in browser runtime.
673
+ * @deprecated
666
674
* @internal
667
675
*/
668
- credentialDefaultProvider ?: ( input : any ) => __Provider < __Credentials > ;
676
+ credentialDefaultProvider ?: ( input : any ) => AwsCredentialIdentityProvider ;
669
677
670
- /**
671
- * Whether to escape request path when signing the request.
672
- */
673
- signingEscapePath ?: boolean ;
674
-
675
- /**
676
- * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false.
677
- */
678
- useArnRegion ?: boolean | Provider < boolean > ;
679
678
/**
680
679
* Value for how many times a request will be made at most in case of retry.
681
680
*/
@@ -708,6 +707,15 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
708
707
*/
709
708
defaultsMode ?: __DefaultsMode | __Provider < __DefaultsMode > ;
710
709
710
+ /**
711
+ * Whether to escape request path when signing the request.
712
+ */
713
+ signingEscapePath ?: boolean ;
714
+
715
+ /**
716
+ * Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false.
717
+ */
718
+ useArnRegion ?: boolean | Provider < boolean > ;
711
719
/**
712
720
* The internal function that inject utilities to runtime-specific stream to help users consume the data
713
721
* @internal
@@ -725,9 +733,9 @@ export type S3ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOpti
725
733
RegionInputConfig &
726
734
HostHeaderInputConfig &
727
735
EndpointInputConfig < EndpointParameters > &
728
- AwsAuthInputConfig &
729
- S3InputConfig &
730
736
EventStreamSerdeInputConfig &
737
+ HttpAuthSchemeInputConfig &
738
+ S3InputConfig &
731
739
ClientInputEndpointParameters ;
732
740
/**
733
741
* @public
@@ -747,9 +755,9 @@ export type S3ClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHan
747
755
RegionResolvedConfig &
748
756
HostHeaderResolvedConfig &
749
757
EndpointResolvedConfig < EndpointParameters > &
750
- AwsAuthResolvedConfig &
751
- S3ResolvedConfig &
752
758
EventStreamSerdeResolvedConfig &
759
+ HttpAuthSchemeResolvedConfig &
760
+ S3ResolvedConfig &
753
761
ClientResolvedEndpointParameters ;
754
762
/**
755
763
* @public
@@ -781,9 +789,9 @@ export class S3Client extends __Client<
781
789
const _config_4 = resolveRegionConfig ( _config_3 ) ;
782
790
const _config_5 = resolveHostHeaderConfig ( _config_4 ) ;
783
791
const _config_6 = resolveEndpointConfig ( _config_5 ) ;
784
- const _config_7 = resolveAwsAuthConfig ( _config_6 ) ;
785
- const _config_8 = resolveS3Config ( _config_7 , { session : [ ( ) => this , CreateSessionCommand ] } ) ;
786
- const _config_9 = resolveEventStreamSerdeConfig ( _config_8 ) ;
792
+ const _config_7 = resolveEventStreamSerdeConfig ( _config_6 ) ;
793
+ const _config_8 = resolveHttpAuthSchemeConfig ( _config_7 ) ;
794
+ const _config_9 = resolveS3Config ( _config_8 , { session : [ ( ) => this , CreateSessionCommand ] } ) ;
787
795
const _config_10 = resolveRuntimeExtensions ( _config_9 , configuration ?. extensions || [ ] ) ;
788
796
super ( _config_10 ) ;
789
797
this . config = _config_10 ;
@@ -793,11 +801,22 @@ export class S3Client extends __Client<
793
801
this . middlewareStack . use ( getHostHeaderPlugin ( this . config ) ) ;
794
802
this . middlewareStack . use ( getLoggerPlugin ( this . config ) ) ;
795
803
this . middlewareStack . use ( getRecursionDetectionPlugin ( this . config ) ) ;
796
- this . middlewareStack . use ( getAwsAuthPlugin ( this . config ) ) ;
804
+ this . middlewareStack . use (
805
+ getHttpAuthSchemeEndpointRuleSetPlugin ( this . config , {
806
+ httpAuthSchemeParametersProvider : defaultS3HttpAuthSchemeParametersProvider ,
807
+ identityProviderConfigProvider : async ( config : S3ClientResolvedConfig ) =>
808
+ new DefaultIdentityProviderConfig ( {
809
+ "aws.auth#sigv4" : config . credentials ,
810
+ "aws.auth#sigv4a" : config . credentials ,
811
+ } ) ,
812
+ } )
813
+ ) ;
814
+ this . middlewareStack . use ( getHttpSigningPlugin ( this . config ) ) ;
797
815
this . middlewareStack . use ( getValidateBucketNamePlugin ( this . config ) ) ;
798
816
this . middlewareStack . use ( getAddExpectContinuePlugin ( this . config ) ) ;
799
817
this . middlewareStack . use ( getRegionRedirectMiddlewarePlugin ( this . config ) ) ;
800
818
this . middlewareStack . use ( getS3ExpressPlugin ( this . config ) ) ;
819
+ this . middlewareStack . use ( getS3ExpressHttpSigningPlugin ( this . config ) ) ;
801
820
}
802
821
803
822
/**
0 commit comments