@aws-sdk/credential-provider-ini 3.935.0 → 3.936.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
@@ -3,6 +3,7 @@
3
3
  var sharedIniFileLoader = require('@smithy/shared-ini-file-loader');
4
4
  var propertyProvider = require('@smithy/property-provider');
5
5
  var client = require('@aws-sdk/core/client');
6
+ var credentialProviderLogin = require('@aws-sdk/credential-provider-login');
6
7
 
7
8
  const resolveCredentialSource = (credentialSource, profileName, logger) => {
8
9
  const sourceProvidersMap = {
@@ -109,6 +110,17 @@ const isCredentialSourceWithoutRoleArn = (section) => {
109
110
  return !section.role_arn && !!section.credential_source;
110
111
  };
111
112
 
113
+ const isLoginProfile = (data) => {
114
+ return Boolean(data && data.login_session);
115
+ };
116
+ const resolveLoginCredentials = async (profileName, options) => {
117
+ const credentials = await credentialProviderLogin.fromLoginCredentials({
118
+ ...options,
119
+ profile: profileName,
120
+ })();
121
+ return client.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
122
+ };
123
+
112
124
  const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
113
125
  const resolveProcessCredentials = async (options, profile) => import('@aws-sdk/credential-provider-process').then(({ fromProcess }) => fromProcess({
114
126
  ...options,
@@ -190,6 +202,9 @@ const resolveProfileData = async (profileName, profiles, options, visitedProfile
190
202
  if (isSsoProfile(data)) {
191
203
  return await resolveSsoCredentials(profileName, data, options);
192
204
  }
205
+ if (isLoginProfile(data)) {
206
+ return resolveLoginCredentials(profileName, options);
207
+ }
193
208
  throw new propertyProvider.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
194
209
  };
195
210
 
@@ -0,0 +1,12 @@
1
+ import { setCredentialFeature } from "@aws-sdk/core/client";
2
+ import { fromLoginCredentials } from "@aws-sdk/credential-provider-login";
3
+ export const isLoginProfile = (data) => {
4
+ return Boolean(data && data.login_session);
5
+ };
6
+ export const resolveLoginCredentials = async (profileName, options) => {
7
+ const credentials = await fromLoginCredentials({
8
+ ...options,
9
+ profile: profileName,
10
+ })();
11
+ return setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
12
+ };
@@ -1,5 +1,6 @@
1
1
  import { CredentialsProviderError } from "@smithy/property-provider";
2
2
  import { isAssumeRoleProfile, resolveAssumeRoleCredentials } from "./resolveAssumeRoleCredentials";
3
+ import { isLoginProfile, resolveLoginCredentials } from "./resolveLoginCredentials";
3
4
  import { isProcessProfile, resolveProcessCredentials } from "./resolveProcessCredentials";
4
5
  import { isSsoProfile, resolveSsoCredentials } from "./resolveSsoCredentials";
5
6
  import { isStaticCredsProfile, resolveStaticCredentials } from "./resolveStaticCredentials";
@@ -24,5 +25,8 @@ export const resolveProfileData = async (profileName, profiles, options, visited
24
25
  if (isSsoProfile(data)) {
25
26
  return await resolveSsoCredentials(profileName, data, options);
26
27
  }
28
+ if (isLoginProfile(data)) {
29
+ return resolveLoginCredentials(profileName, options);
30
+ }
27
31
  throw new CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
28
32
  };
@@ -1,3 +1,4 @@
1
+ import type { FromLoginCredentialsInit } from "@aws-sdk/credential-provider-login";
1
2
  import type { AssumeRoleWithWebIdentityParams } from "@aws-sdk/credential-provider-web-identity";
2
3
  import type { CredentialProviderOptions } from "@aws-sdk/types";
3
4
  import type { RuntimeConfigAwsCredentialIdentityProvider } from "@aws-sdk/types";
@@ -7,7 +8,7 @@ import { AssumeRoleParams } from "./resolveAssumeRoleCredentials";
7
8
  /**
8
9
  * @public
9
10
  */
10
- export interface FromIniInit extends SourceProfileInit, CredentialProviderOptions {
11
+ export interface FromIniInit extends SourceProfileInit, CredentialProviderOptions, FromLoginCredentialsInit {
11
12
  /**
12
13
  * A function that returns a promise fulfilled with an MFA token code for
13
14
  * the provided MFA Serial code. If a profile requires an MFA code and
@@ -34,8 +35,8 @@ export interface FromIniInit extends SourceProfileInit, CredentialProviderOption
34
35
  */
35
36
  roleAssumerWithWebIdentity?: (params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>;
36
37
  /**
37
- * STSClientConfig or SSOClientConfig to be used for creating inner client
38
- * for auth operations.
38
+ * AWS SDK Client configuration to be used for creating inner client
39
+ * for auth operations. Inner clients include STS, SSO, and Signin clients.
39
40
  * @internal
40
41
  */
41
42
  clientConfig?: any;
@@ -0,0 +1,10 @@
1
+ import type { AwsCredentialIdentity, ParsedIniData } from "@smithy/types";
2
+ import type { FromIniInit } from "./fromIni";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare const isLoginProfile: (data: ParsedIniData[string]) => boolean;
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare const resolveLoginCredentials: (profileName: string, options: FromIniInit) => Promise<AwsCredentialIdentity>;
@@ -1,3 +1,4 @@
1
+ import { FromLoginCredentialsInit } from "@aws-sdk/credential-provider-login";
1
2
  import { AssumeRoleWithWebIdentityParams } from "@aws-sdk/credential-provider-web-identity";
2
3
  import { CredentialProviderOptions } from "@aws-sdk/types";
3
4
  import { RuntimeConfigAwsCredentialIdentityProvider } from "@aws-sdk/types";
@@ -6,7 +7,8 @@ import { AwsCredentialIdentity, Pluggable } from "@smithy/types";
6
7
  import { AssumeRoleParams } from "./resolveAssumeRoleCredentials";
7
8
  export interface FromIniInit
8
9
  extends SourceProfileInit,
9
- CredentialProviderOptions {
10
+ CredentialProviderOptions,
11
+ FromLoginCredentialsInit {
10
12
  mfaCodeProvider?: (mfaSerial: string) => Promise<string>;
11
13
  roleAssumer?: (
12
14
  sourceCreds: AwsCredentialIdentity,
@@ -0,0 +1,7 @@
1
+ import { AwsCredentialIdentity, ParsedIniData } from "@smithy/types";
2
+ import { FromIniInit } from "./fromIni";
3
+ export declare const isLoginProfile: (data: ParsedIniData[string]) => boolean;
4
+ export declare const resolveLoginCredentials: (
5
+ profileName: string,
6
+ options: FromIniInit
7
+ ) => Promise<AwsCredentialIdentity>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-ini",
3
- "version": "3.935.0",
3
+ "version": "3.936.0",
4
4
  "description": "AWS credential provider that sources credentials from ~/.aws/credentials and ~/.aws/config",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -28,14 +28,15 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@aws-sdk/core": "3.935.0",
32
- "@aws-sdk/credential-provider-env": "3.935.0",
33
- "@aws-sdk/credential-provider-http": "3.935.0",
34
- "@aws-sdk/credential-provider-process": "3.935.0",
35
- "@aws-sdk/credential-provider-sso": "3.935.0",
36
- "@aws-sdk/credential-provider-web-identity": "3.935.0",
37
- "@aws-sdk/nested-clients": "3.935.0",
38
- "@aws-sdk/types": "3.930.0",
31
+ "@aws-sdk/core": "3.936.0",
32
+ "@aws-sdk/credential-provider-env": "3.936.0",
33
+ "@aws-sdk/credential-provider-http": "3.936.0",
34
+ "@aws-sdk/credential-provider-login": "3.936.0",
35
+ "@aws-sdk/credential-provider-process": "3.936.0",
36
+ "@aws-sdk/credential-provider-sso": "3.936.0",
37
+ "@aws-sdk/credential-provider-web-identity": "3.936.0",
38
+ "@aws-sdk/nested-clients": "3.936.0",
39
+ "@aws-sdk/types": "3.936.0",
39
40
  "@smithy/credential-provider-imds": "^4.2.5",
40
41
  "@smithy/property-provider": "^4.2.5",
41
42
  "@smithy/shared-ini-file-loader": "^4.4.0",