@aws-sdk/credential-provider-sso 3.209.0 → 3.211.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.
@@ -12,7 +12,13 @@ const fromSSO = (init = {}) => async () => {
12
12
  if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
13
13
  const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init);
14
14
  const profile = profiles[profileName];
15
- if (profile.sso_session) {
15
+ if (!profile) {
16
+ throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} was not found.`);
17
+ }
18
+ if (!(0, isSsoProfile_1.isSsoProfile)(profile)) {
19
+ throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`);
20
+ }
21
+ if (profile === null || profile === void 0 ? void 0 : profile.sso_session) {
16
22
  const ssoSessions = await (0, shared_ini_file_loader_1.loadSsoSessionData)(init);
17
23
  const session = ssoSessions[profile.sso_session];
18
24
  const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
@@ -25,9 +31,6 @@ const fromSSO = (init = {}) => async () => {
25
31
  profile.sso_region = session.sso_region;
26
32
  profile.sso_start_url = session.sso_start_url;
27
33
  }
28
- if (!(0, isSsoProfile_1.isSsoProfile)(profile)) {
29
- throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`);
30
- }
31
34
  const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = (0, validateSsoProfile_1.validateSsoProfile)(profile);
32
35
  return (0, resolveSSOCredentials_1.resolveSSOCredentials)({
33
36
  ssoStartUrl: sso_start_url,
@@ -9,7 +9,13 @@ export const fromSSO = (init = {}) => async () => {
9
9
  if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
10
10
  const profiles = await parseKnownFiles(init);
11
11
  const profile = profiles[profileName];
12
- if (profile.sso_session) {
12
+ if (!profile) {
13
+ throw new CredentialsProviderError(`Profile ${profileName} was not found.`);
14
+ }
15
+ if (!isSsoProfile(profile)) {
16
+ throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`);
17
+ }
18
+ if (profile?.sso_session) {
13
19
  const ssoSessions = await loadSsoSessionData(init);
14
20
  const session = ssoSessions[profile.sso_session];
15
21
  const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
@@ -22,9 +28,6 @@ export const fromSSO = (init = {}) => async () => {
22
28
  profile.sso_region = session.sso_region;
23
29
  profile.sso_start_url = session.sso_start_url;
24
30
  }
25
- if (!isSsoProfile(profile)) {
26
- throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`);
27
- }
28
31
  const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile);
29
32
  return resolveSSOCredentials({
30
33
  ssoStartUrl: sso_start_url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-sso",
3
- "version": "3.209.0",
3
+ "version": "3.211.0",
4
4
  "description": "AWS credential provider that exchanges a resolved SSO login token file for temporary AWS credentials",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@aws-sdk/client-sso": "3.209.0",
27
+ "@aws-sdk/client-sso": "3.211.0",
28
28
  "@aws-sdk/property-provider": "3.208.0",
29
29
  "@aws-sdk/shared-ini-file-loader": "3.209.0",
30
- "@aws-sdk/token-providers": "3.209.0",
30
+ "@aws-sdk/token-providers": "3.211.0",
31
31
  "@aws-sdk/types": "3.208.0",
32
32
  "tslib": "^2.3.1"
33
33
  },