@aws-sdk/token-providers 3.947.0 → 3.952.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -23,9 +23,9 @@ const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
23
23
  const EXPIRE_WINDOW_MS = 5 * 60 * 1000;
24
24
  const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
25
25
 
26
- const getSsoOidcClient = async (ssoRegion, init = {}) => {
26
+ const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
27
27
  const { SSOOIDCClient } = await import('@aws-sdk/nested-clients/sso-oidc');
28
- const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop];
28
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
29
29
  const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
30
30
  region: ssoRegion ?? init.clientConfig?.region,
31
31
  logger: coalesce("logger"),
@@ -34,9 +34,9 @@ const getSsoOidcClient = async (ssoRegion, init = {}) => {
34
34
  return ssoOidcClient;
35
35
  };
36
36
 
37
- const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}) => {
37
+ const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
38
38
  const { CreateTokenCommand } = await import('@aws-sdk/nested-clients/sso-oidc');
39
- const ssoOidcClient = await getSsoOidcClient(ssoRegion, init);
39
+ const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
40
40
  return ssoOidcClient.send(new CreateTokenCommand({
41
41
  clientId: ssoToken.clientId,
42
42
  clientSecret: ssoToken.clientSecret,
@@ -65,14 +65,7 @@ const writeSSOTokenToFile = (id, ssoToken) => {
65
65
  };
66
66
 
67
67
  const lastRefreshAttemptTime = new Date(0);
68
- const fromSso = (_init = {}) => async ({ callerClientConfig } = {}) => {
69
- const init = {
70
- ..._init,
71
- parentClientConfig: {
72
- ...callerClientConfig,
73
- ..._init.parentClientConfig,
74
- },
75
- };
68
+ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
76
69
  init.logger?.debug("@aws-sdk/token-providers - fromSso");
77
70
  const profiles = await sharedIniFileLoader.parseKnownFiles(init);
78
71
  const profileName = sharedIniFileLoader.getProfileName({
@@ -121,7 +114,7 @@ const fromSso = (_init = {}) => async ({ callerClientConfig } = {}) => {
121
114
  validateTokenKey("refreshToken", ssoToken.refreshToken, true);
122
115
  try {
123
116
  lastRefreshAttemptTime.setTime(Date.now());
124
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init);
117
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
125
118
  validateTokenKey("accessToken", newSsoOidcToken.accessToken);
126
119
  validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
127
120
  const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
@@ -6,14 +6,7 @@ import { validateTokenExpiry } from "./validateTokenExpiry";
6
6
  import { validateTokenKey } from "./validateTokenKey";
7
7
  import { writeSSOTokenToFile } from "./writeSSOTokenToFile";
8
8
  const lastRefreshAttemptTime = new Date(0);
9
- export const fromSso = (_init = {}) => async ({ callerClientConfig } = {}) => {
10
- const init = {
11
- ..._init,
12
- parentClientConfig: {
13
- ...callerClientConfig,
14
- ..._init.parentClientConfig,
15
- },
16
- };
9
+ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
17
10
  init.logger?.debug("@aws-sdk/token-providers - fromSso");
18
11
  const profiles = await parseKnownFiles(init);
19
12
  const profileName = getProfileName({
@@ -62,7 +55,7 @@ export const fromSso = (_init = {}) => async ({ callerClientConfig } = {}) => {
62
55
  validateTokenKey("refreshToken", ssoToken.refreshToken, true);
63
56
  try {
64
57
  lastRefreshAttemptTime.setTime(Date.now());
65
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init);
58
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
66
59
  validateTokenKey("accessToken", newSsoOidcToken.accessToken);
67
60
  validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
68
61
  const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
@@ -1,7 +1,7 @@
1
1
  import { getSsoOidcClient } from "./getSsoOidcClient";
2
- export const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}) => {
2
+ export const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
3
3
  const { CreateTokenCommand } = await import("@aws-sdk/nested-clients/sso-oidc");
4
- const ssoOidcClient = await getSsoOidcClient(ssoRegion, init);
4
+ const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
5
5
  return ssoOidcClient.send(new CreateTokenCommand({
6
6
  clientId: ssoToken.clientId,
7
7
  clientSecret: ssoToken.clientSecret,
@@ -1,6 +1,6 @@
1
- export const getSsoOidcClient = async (ssoRegion, init = {}) => {
1
+ export const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
2
2
  const { SSOOIDCClient } = await import("@aws-sdk/nested-clients/sso-oidc");
3
- const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop];
3
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
4
4
  const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
5
5
  region: ssoRegion ?? init.clientConfig?.region,
6
6
  logger: coalesce("logger"),
@@ -9,4 +9,4 @@ export interface FromSsoInit extends SourceProfileInit, CredentialProviderOption
9
9
  /**
10
10
  * Creates a token provider that will read from SSO token cache or ssoOidc.createToken() call.
11
11
  */
12
- export declare const fromSso: (_init?: FromSsoInit) => RuntimeConfigIdentityProvider<TokenIdentity>;
12
+ export declare const fromSso: (init?: FromSsoInit) => RuntimeConfigIdentityProvider<TokenIdentity>;
@@ -1,7 +1,8 @@
1
+ import type { AwsIdentityProperties } from "@aws-sdk/types";
1
2
  import { SSOToken } from "@smithy/shared-ini-file-loader";
2
3
  import { FromSsoInit } from "./fromSso";
3
4
  /**
4
- * Returns a new SSO OIDC token from ssoOids.createToken() API call.
5
+ * Returns a new SSO OIDC token from SSOOIDC::createToken() API call.
5
6
  * @internal
6
7
  */
7
- export declare const getNewSsoOidcToken: (ssoToken: SSOToken, ssoRegion: string, init?: FromSsoInit) => Promise<import("@aws-sdk/nested-clients/sso-oidc").CreateTokenCommandOutput>;
8
+ export declare const getNewSsoOidcToken: (ssoToken: SSOToken, ssoRegion: string, init?: FromSsoInit, callerClientConfig?: AwsIdentityProperties["callerClientConfig"]) => Promise<import("@aws-sdk/nested-clients/sso-oidc").CreateTokenCommandOutput>;
@@ -1,6 +1,7 @@
1
+ import type { AwsIdentityProperties } from "@aws-sdk/types";
1
2
  import { FromSsoInit } from "./fromSso";
2
3
  /**
3
4
  * Returns a SSOOIDC client for the given region.
4
5
  * @internal
5
6
  */
6
- export declare const getSsoOidcClient: (ssoRegion: string, init?: FromSsoInit) => Promise<import("@aws-sdk/nested-clients/sso-oidc").SSOOIDCClient>;
7
+ export declare const getSsoOidcClient: (ssoRegion: string, init?: FromSsoInit, callerClientConfig?: AwsIdentityProperties["callerClientConfig"]) => Promise<import("@aws-sdk/nested-clients/sso-oidc").SSOOIDCClient>;
@@ -10,5 +10,5 @@ export interface FromSsoInit
10
10
  clientConfig?: any;
11
11
  }
12
12
  export declare const fromSso: (
13
- _init?: FromSsoInit
13
+ init?: FromSsoInit
14
14
  ) => RuntimeConfigIdentityProvider<TokenIdentity>;
@@ -1,9 +1,11 @@
1
+ import { AwsIdentityProperties } from "@aws-sdk/types";
1
2
  import { SSOToken } from "@smithy/shared-ini-file-loader";
2
3
  import { FromSsoInit } from "./fromSso";
3
4
  export declare const getNewSsoOidcToken: (
4
5
  ssoToken: SSOToken,
5
6
  ssoRegion: string,
6
- init?: FromSsoInit
7
+ init?: FromSsoInit,
8
+ callerClientConfig?: AwsIdentityProperties["callerClientConfig"]
7
9
  ) => Promise<
8
10
  import("@aws-sdk/nested-clients/sso-oidc").CreateTokenCommandOutput
9
11
  >;
@@ -1,5 +1,7 @@
1
+ import { AwsIdentityProperties } from "@aws-sdk/types";
1
2
  import { FromSsoInit } from "./fromSso";
2
3
  export declare const getSsoOidcClient: (
3
4
  ssoRegion: string,
4
- init?: FromSsoInit
5
+ init?: FromSsoInit,
6
+ callerClientConfig?: AwsIdentityProperties["callerClientConfig"]
5
7
  ) => Promise<import("@aws-sdk/nested-clients/sso-oidc").SSOOIDCClient>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.947.0",
3
+ "version": "3.952.0",
4
4
  "description": "A collection of token providers",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -30,7 +30,7 @@
30
30
  "license": "Apache-2.0",
31
31
  "dependencies": {
32
32
  "@aws-sdk/core": "3.947.0",
33
- "@aws-sdk/nested-clients": "3.947.0",
33
+ "@aws-sdk/nested-clients": "3.952.0",
34
34
  "@aws-sdk/types": "3.936.0",
35
35
  "@smithy/property-provider": "^4.2.5",
36
36
  "@smithy/shared-ini-file-loader": "^4.4.0",