-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(id-auth-sra): S3 Express compatibility with ID & Auth SRA (#6346)
* chore(id-auth-sra): remove s3 from useLegacyAuth list * chore(client-s3): turn off useLegacyAuth * chore(client-s3): id-auth sra and regionRedirect compatibility * chore(client-s3): compatibility for S3Express and httpsigning midware
- Loading branch information
Showing
20 changed files
with
690 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
clients/client-s3/src/auth/httpAuthExtensionConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// smithy-typescript generated code | ||
import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types"; | ||
|
||
import { S3HttpAuthSchemeProvider } from "./httpAuthSchemeProvider"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export interface HttpAuthExtensionConfiguration { | ||
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void; | ||
httpAuthSchemes(): HttpAuthScheme[]; | ||
setHttpAuthSchemeProvider(httpAuthSchemeProvider: S3HttpAuthSchemeProvider): void; | ||
httpAuthSchemeProvider(): S3HttpAuthSchemeProvider; | ||
setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void; | ||
credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export type HttpAuthRuntimeConfig = Partial<{ | ||
httpAuthSchemes: HttpAuthScheme[]; | ||
httpAuthSchemeProvider: S3HttpAuthSchemeProvider; | ||
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider; | ||
}>; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const getHttpAuthExtensionConfiguration = ( | ||
runtimeConfig: HttpAuthRuntimeConfig | ||
): HttpAuthExtensionConfiguration => { | ||
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!; | ||
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!; | ||
let _credentials = runtimeConfig.credentials; | ||
return { | ||
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void { | ||
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); | ||
if (index === -1) { | ||
_httpAuthSchemes.push(httpAuthScheme); | ||
} else { | ||
_httpAuthSchemes.splice(index, 1, httpAuthScheme); | ||
} | ||
}, | ||
httpAuthSchemes(): HttpAuthScheme[] { | ||
return _httpAuthSchemes; | ||
}, | ||
setHttpAuthSchemeProvider(httpAuthSchemeProvider: S3HttpAuthSchemeProvider): void { | ||
_httpAuthSchemeProvider = httpAuthSchemeProvider; | ||
}, | ||
httpAuthSchemeProvider(): S3HttpAuthSchemeProvider { | ||
return _httpAuthSchemeProvider; | ||
}, | ||
setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void { | ||
_credentials = credentials; | ||
}, | ||
credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined { | ||
return _credentials; | ||
}, | ||
}; | ||
}; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => { | ||
return { | ||
httpAuthSchemes: config.httpAuthSchemes(), | ||
httpAuthSchemeProvider: config.httpAuthSchemeProvider(), | ||
credentials: config.credentials(), | ||
}; | ||
}; |
Oops, something went wrong.