File tree Expand file tree Collapse file tree 5 files changed +48
-54
lines changed
packages/experimental-identity-and-auth/src Expand file tree Collapse file tree 5 files changed +48
-54
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @smithy/experimental-identity-and-auth " : patch
3
+ ---
4
+
5
+ INTERNAL USE ONLY: Update ` HttpAuthScheme ` and ` IdentityProviderConfig ` interfaces
Original file line number Diff line number Diff line change 1
1
import { Identity , IdentityProvider } from "@smithy/types" ;
2
2
3
3
import { HttpSigner } from "./HttpSigner" ;
4
+ import { IdentityProviderConfig } from "./IdentityProviderConfig" ;
4
5
5
6
/**
6
7
* ID for {@link HttpAuthScheme}
@@ -18,9 +19,9 @@ export interface HttpAuthScheme {
18
19
*/
19
20
schemeId : HttpAuthSchemeId ;
20
21
/**
21
- * IdentityProvider corresponding to an HttpAuthScheme.
22
+ * Gets the IdentityProvider corresponding to an HttpAuthScheme.
22
23
*/
23
- identityProvider : IdentityProvider < Identity > ;
24
+ identityProvider ( config : IdentityProviderConfig ) : IdentityProvider < Identity > | undefined ;
24
25
/**
25
26
* HttpSigner corresponding to an HttpAuthScheme.
26
27
*/
Original file line number Diff line number Diff line change
1
+ import { Identity , IdentityProvider } from "@smithy/types" ;
2
+
3
+ import { HttpAuthSchemeId } from "./HttpAuthScheme" ;
4
+
5
+ /**
6
+ * Interface to get an IdentityProvider for a specified HttpAuthScheme
7
+ * @internal
8
+ */
9
+ export interface IdentityProviderConfig {
10
+ /**
11
+ * Get the IdentityProvider for a specified HttpAuthScheme.
12
+ * @param schemeId schemeId of the HttpAuthScheme
13
+ * @returns IdentityProvider or undefined if HttpAuthScheme is not found
14
+ */
15
+ getIdentityProvider ( schemeId : HttpAuthSchemeId ) : IdentityProvider < Identity > | undefined ;
16
+ }
17
+
18
+ /**
19
+ * Default implementation of IddentityProviderConfig
20
+ * @internal
21
+ */
22
+ export class DefaultIdentityProviderConfig implements IdentityProviderConfig {
23
+ private authSchemes : Map < HttpAuthSchemeId , IdentityProvider < Identity > > = new Map ( ) ;
24
+
25
+ /**
26
+ * Creates an IdentityProviderConfig with a record of scheme IDs to identity providers.
27
+ *
28
+ * @param config scheme IDs and identity providers to configure
29
+ */
30
+ constructor ( config : Record < HttpAuthSchemeId , IdentityProvider < Identity > > ) {
31
+ for ( const [ key , value ] of Object . entries ( config ) ) {
32
+ this . authSchemes . set ( key , value ) ;
33
+ }
34
+ }
35
+
36
+ public getIdentityProvider ( schemeId : HttpAuthSchemeId ) : IdentityProvider < Identity > | undefined {
37
+ return this . authSchemes . get ( schemeId ) ;
38
+ }
39
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- export * from "./IdentityProviderConfiguration" ;
2
1
export * from "./HttpAuthScheme" ;
3
2
export * from "./HttpSigner" ;
3
+ export * from "./IdentityProviderConfig" ;
4
4
export * from "./SigV4Signer" ;
5
5
export * from "./apiKeyIdentity" ;
6
6
export * from "./httpApiKeyAuth" ;
You can’t perform that action at this time.
0 commit comments