@aws-sdk/credential-provider-sso 3.496.0 → 3.502.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 +28 -7
- package/dist-cjs/loadSso.js +1 -0
- package/dist-es/fromSSO.js +7 -1
- package/dist-es/loadSso.js +2 -0
- package/dist-es/resolveSSOCredentials.js +2 -3
- package/dist-types/fromSSO.d.ts +4 -2
- package/dist-types/loadSso.d.ts +3 -0
- package/dist-types/ts3.4/fromSSO.d.ts +6 -2
- package/dist-types/ts3.4/loadSso.d.ts +6 -0
- package/package.json +4 -4
package/dist-cjs/index.js
CHANGED
|
@@ -3,6 +3,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
6
9
|
var __export = (target, all) => {
|
|
7
10
|
for (var name in all)
|
|
8
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,6 +20,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
20
|
};
|
|
18
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
22
|
|
|
23
|
+
// src/loadSso.ts
|
|
24
|
+
var loadSso_exports = {};
|
|
25
|
+
__export(loadSso_exports, {
|
|
26
|
+
GetRoleCredentialsCommand: () => import_client_sso.GetRoleCredentialsCommand,
|
|
27
|
+
SSOClient: () => import_client_sso.SSOClient
|
|
28
|
+
});
|
|
29
|
+
var import_client_sso;
|
|
30
|
+
var init_loadSso = __esm({
|
|
31
|
+
"src/loadSso.ts"() {
|
|
32
|
+
import_client_sso = require("@aws-sdk/client-sso");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
20
36
|
// src/index.ts
|
|
21
37
|
var src_exports = {};
|
|
22
38
|
__export(src_exports, {
|
|
@@ -34,7 +50,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
34
50
|
var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile");
|
|
35
51
|
|
|
36
52
|
// src/resolveSSOCredentials.ts
|
|
37
|
-
var import_client_sso = require("@aws-sdk/client-sso");
|
|
38
53
|
var import_token_providers = require("@aws-sdk/token-providers");
|
|
39
54
|
var import_property_provider = require("@smithy/property-provider");
|
|
40
55
|
var import_shared_ini_file_loader = require("@smithy/shared-ini-file-loader");
|
|
@@ -48,7 +63,6 @@ var resolveSSOCredentials = /* @__PURE__ */ __name(async ({
|
|
|
48
63
|
ssoClient,
|
|
49
64
|
profile
|
|
50
65
|
}) => {
|
|
51
|
-
var _a;
|
|
52
66
|
let token;
|
|
53
67
|
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
54
68
|
if (ssoSession) {
|
|
@@ -78,11 +92,12 @@ var resolveSSOCredentials = /* @__PURE__ */ __name(async ({
|
|
|
78
92
|
);
|
|
79
93
|
}
|
|
80
94
|
const { accessToken } = token;
|
|
81
|
-
const
|
|
95
|
+
const { SSOClient: SSOClient2, GetRoleCredentialsCommand: GetRoleCredentialsCommand2 } = await Promise.resolve().then(() => (init_loadSso(), loadSso_exports));
|
|
96
|
+
const sso = ssoClient || new SSOClient2({ region: ssoRegion });
|
|
82
97
|
let ssoResp;
|
|
83
98
|
try {
|
|
84
99
|
ssoResp = await sso.send(
|
|
85
|
-
new
|
|
100
|
+
new GetRoleCredentialsCommand2({
|
|
86
101
|
accountId: ssoAccountId,
|
|
87
102
|
roleName: ssoRoleName,
|
|
88
103
|
accessToken
|
|
@@ -91,8 +106,7 @@ var resolveSSOCredentials = /* @__PURE__ */ __name(async ({
|
|
|
91
106
|
} catch (e) {
|
|
92
107
|
throw import_property_provider.CredentialsProviderError.from(e, SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
93
108
|
}
|
|
94
|
-
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration } = {} } = ssoResp;
|
|
95
|
-
const credentialScope = (_a = ssoResp == null ? void 0 : ssoResp.roleCredentials) == null ? void 0 : _a.credentialScope;
|
|
109
|
+
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope } = {} } = ssoResp;
|
|
96
110
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
97
111
|
throw new import_property_provider.CredentialsProviderError("SSO returns an invalid temporary credential.", SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
98
112
|
}
|
|
@@ -117,7 +131,14 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
117
131
|
|
|
118
132
|
// src/fromSSO.ts
|
|
119
133
|
var fromSSO = /* @__PURE__ */ __name((init = {}) => async () => {
|
|
120
|
-
|
|
134
|
+
var _a;
|
|
135
|
+
(_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-sso", "fromSSO");
|
|
136
|
+
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
137
|
+
let { ssoClient } = init;
|
|
138
|
+
if (!ssoClient) {
|
|
139
|
+
const { SSOClient: SSOClient2 } = await Promise.resolve().then(() => (init_loadSso(), loadSso_exports));
|
|
140
|
+
ssoClient = new SSOClient2(init.clientConfig ?? {});
|
|
141
|
+
}
|
|
121
142
|
const profileName = (0, import_shared_ini_file_loader.getProfileName)(init);
|
|
122
143
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
123
144
|
const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-es/fromSSO.js
CHANGED
|
@@ -4,7 +4,13 @@ import { isSsoProfile } from "./isSsoProfile";
|
|
|
4
4
|
import { resolveSSOCredentials } from "./resolveSSOCredentials";
|
|
5
5
|
import { validateSsoProfile } from "./validateSsoProfile";
|
|
6
6
|
export const fromSSO = (init = {}) => async () => {
|
|
7
|
-
|
|
7
|
+
init.logger?.debug("@aws-sdk/credential-provider-sso", "fromSSO");
|
|
8
|
+
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
9
|
+
let { ssoClient } = init;
|
|
10
|
+
if (!ssoClient) {
|
|
11
|
+
const { SSOClient } = await import("./loadSso");
|
|
12
|
+
ssoClient = new SSOClient(init.clientConfig ?? {});
|
|
13
|
+
}
|
|
8
14
|
const profileName = getProfileName(init);
|
|
9
15
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
10
16
|
const profiles = await parseKnownFiles(init);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GetRoleCredentialsCommand, SSOClient } from "@aws-sdk/client-sso";
|
|
2
1
|
import { fromSso as getSsoTokenProvider } from "@aws-sdk/token-providers";
|
|
3
2
|
import { CredentialsProviderError } from "@smithy/property-provider";
|
|
4
3
|
import { getSSOTokenFromFile } from "@smithy/shared-ini-file-loader";
|
|
@@ -30,6 +29,7 @@ export const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccoun
|
|
|
30
29
|
throw new CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
31
30
|
}
|
|
32
31
|
const { accessToken } = token;
|
|
32
|
+
const { SSOClient, GetRoleCredentialsCommand } = await import("./loadSso");
|
|
33
33
|
const sso = ssoClient || new SSOClient({ region: ssoRegion });
|
|
34
34
|
let ssoResp;
|
|
35
35
|
try {
|
|
@@ -42,8 +42,7 @@ export const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccoun
|
|
|
42
42
|
catch (e) {
|
|
43
43
|
throw CredentialsProviderError.from(e, SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
44
44
|
}
|
|
45
|
-
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration } = {} } = ssoResp;
|
|
46
|
-
const credentialScope = ssoResp?.roleCredentials?.credentialScope;
|
|
45
|
+
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope } = {} } = ssoResp;
|
|
47
46
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
48
47
|
throw new CredentialsProviderError("SSO returns an invalid temporary credential.", SHOULD_FAIL_CREDENTIAL_CHAIN);
|
|
49
48
|
}
|
package/dist-types/fromSSO.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CredentialProviderOptions } from "@aws-sdk/types";
|
|
2
2
|
import { SourceProfileInit } from "@smithy/shared-ini-file-loader";
|
|
3
3
|
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
4
|
+
import type { SSOClient, SSOClientConfig } from "./loadSso";
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
@@ -30,8 +31,9 @@ export interface SsoCredentialsParameters {
|
|
|
30
31
|
/**
|
|
31
32
|
* @internal
|
|
32
33
|
*/
|
|
33
|
-
export interface FromSSOInit extends SourceProfileInit {
|
|
34
|
+
export interface FromSSOInit extends SourceProfileInit, CredentialProviderOptions {
|
|
34
35
|
ssoClient?: SSOClient;
|
|
36
|
+
clientConfig?: SSOClientConfig;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* @internal
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialProviderOptions } from "@aws-sdk/types";
|
|
2
2
|
import { SourceProfileInit } from "@smithy/shared-ini-file-loader";
|
|
3
3
|
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
4
|
+
import { SSOClient, SSOClientConfig } from "./loadSso";
|
|
4
5
|
export interface SsoCredentialsParameters {
|
|
5
6
|
ssoStartUrl: string;
|
|
6
7
|
ssoSession?: string;
|
|
@@ -8,8 +9,11 @@ export interface SsoCredentialsParameters {
|
|
|
8
9
|
ssoRegion: string;
|
|
9
10
|
ssoRoleName: string;
|
|
10
11
|
}
|
|
11
|
-
export interface FromSSOInit
|
|
12
|
+
export interface FromSSOInit
|
|
13
|
+
extends SourceProfileInit,
|
|
14
|
+
CredentialProviderOptions {
|
|
12
15
|
ssoClient?: SSOClient;
|
|
16
|
+
clientConfig?: SSOClientConfig;
|
|
13
17
|
}
|
|
14
18
|
export declare const fromSSO: (
|
|
15
19
|
init?: FromSSOInit & Partial<SsoCredentialsParameters>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-sso",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.502.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,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-sso": "3.
|
|
28
|
-
"@aws-sdk/token-providers": "3.
|
|
29
|
-
"@aws-sdk/types": "3.
|
|
27
|
+
"@aws-sdk/client-sso": "3.502.0",
|
|
28
|
+
"@aws-sdk/token-providers": "3.502.0",
|
|
29
|
+
"@aws-sdk/types": "3.502.0",
|
|
30
30
|
"@smithy/property-provider": "^2.1.1",
|
|
31
31
|
"@smithy/shared-ini-file-loader": "^2.3.1",
|
|
32
32
|
"@smithy/types": "^2.9.1",
|