-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(credential-provider-ini): pass clientConfig to sso and sso-oidc i…
…nner clients
- Loading branch information
Showing
11 changed files
with
96 additions
and
50 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
11 changes: 5 additions & 6 deletions
11
packages/credential-provider-ini/src/resolveSsoCredentials.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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
const ssoOidcClientsHash: Record<string, any> = {}; | ||
import { FromSsoInit } from "./fromSso"; | ||
|
||
/** | ||
* Returns a SSOOIDC client for the given region. If the client has already been created, | ||
* it will be returned from the hash. | ||
* Returns a SSOOIDC client for the given region. | ||
* @internal | ||
*/ | ||
export const getSsoOidcClient = async (ssoRegion: string) => { | ||
export const getSsoOidcClient = async (ssoRegion: string, init: FromSsoInit = {}) => { | ||
// @ts-ignore Cannot find module '@aws-sdk/client-sso-oidc' | ||
const { SSOOIDCClient } = await import("@aws-sdk/client-sso-oidc"); | ||
|
||
// return ssoOidsClient if already created. | ||
if (ssoOidcClientsHash[ssoRegion]) { | ||
return ssoOidcClientsHash[ssoRegion]; | ||
} | ||
|
||
// Create new SSOOIDC client, and store is in hash. | ||
// If we need to support configuration of SsoOidc client in future through code, | ||
// the provision to pass region from client configuration needs to be added. | ||
const ssoOidcClient = new SSOOIDCClient({ region: ssoRegion }); | ||
ssoOidcClientsHash[ssoRegion] = ssoOidcClient; | ||
const ssoOidcClient = new SSOOIDCClient( | ||
Object.assign({}, init.clientConfig ?? {}, { | ||
region: ssoRegion ?? init.clientConfig.region, | ||
logger: init.clientConfig?.logger ?? init.parentClientConfig?.logger, | ||
}) | ||
); | ||
return ssoOidcClient; | ||
}; |