@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.54
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/.jsii +3 -3
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +13439 -13574
- package/node_modules/@aws-sdk/client-iam/package.json +6 -6
- package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
- package/node_modules/@aws-sdk/client-sso/package.json +5 -5
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +1969 -6
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +48 -88
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +35 -74
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +273 -365
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1581 -1863
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/XmlCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +38 -73
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +194 -259
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +72 -132
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +71 -107
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +176 -249
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-CVy8iqsZ.js +14 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +16 -25
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +170 -203
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +583 -858
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +795 -928
- package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +147 -222
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/README.md +22 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/createUserAgentStringParsingProvider.js +57 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.js +39 -8
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/createUserAgentStringParsingProvider.js +20 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js +37 -6
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/createUserAgentStringParsingProvider.d.ts +14 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.d.ts +14 -4
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.native.d.ts +4 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/createUserAgentStringParsingProvider.d.ts +9 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/index.d.ts +5 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -1
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/crt-availability.d.ts +1 -2
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/defaultUserAgent.d.ts +10 -5
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +5 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +32 -30
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +133 -202
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +126 -34
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +19 -17
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +5 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +82 -176
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +22 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js +110 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +4 -26
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/package.json +3 -3
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-base64/dist-cjs/constants.browser.js +9 -32
- package/node_modules/@smithy/util-base64/dist-es/constants.browser.js +9 -28
- package/node_modules/@smithy/util-base64/dist-types/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/dist-types/ts3.4/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/package.json +1 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +8 -6
- package/node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js +8 -6
- package/node_modules/@smithy/util-body-length-node/package.json +1 -1
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +11 -9
- package/node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js +11 -8
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -3
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/dist-cjs/index.js +3 -5
- package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +3 -5
- package/node_modules/@smithy/util-stream/dist-types/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/package.json +3 -3
|
@@ -1,262 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __esm = (fn, res) => function __init() {
|
|
8
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
-
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
|
|
24
|
-
// src/loadSso.ts
|
|
25
|
-
var loadSso_exports = {};
|
|
26
|
-
__export(loadSso_exports, {
|
|
27
|
-
GetRoleCredentialsCommand: () => import_client_sso.GetRoleCredentialsCommand,
|
|
28
|
-
SSOClient: () => import_client_sso.SSOClient
|
|
29
|
-
});
|
|
30
|
-
var import_client_sso;
|
|
31
|
-
var init_loadSso = __esm({
|
|
32
|
-
"src/loadSso.ts"() {
|
|
33
|
-
"use strict";
|
|
34
|
-
import_client_sso = require("@aws-sdk/client-sso");
|
|
35
|
-
}
|
|
36
|
-
});
|
|
1
|
+
'use strict';
|
|
37
2
|
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
isSsoProfile: () => isSsoProfile,
|
|
43
|
-
validateSsoProfile: () => validateSsoProfile
|
|
44
|
-
});
|
|
45
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var propertyProvider = require('@smithy/property-provider');
|
|
4
|
+
var sharedIniFileLoader = require('@smithy/shared-ini-file-loader');
|
|
5
|
+
var client = require('@aws-sdk/core/client');
|
|
6
|
+
var tokenProviders = require('@aws-sdk/token-providers');
|
|
46
7
|
|
|
47
|
-
|
|
8
|
+
const isSsoProfile = (arg) => arg &&
|
|
9
|
+
(typeof arg.sso_start_url === "string" ||
|
|
10
|
+
typeof arg.sso_account_id === "string" ||
|
|
11
|
+
typeof arg.sso_session === "string" ||
|
|
12
|
+
typeof arg.sso_region === "string" ||
|
|
13
|
+
typeof arg.sso_role_name === "string");
|
|
48
14
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
ignoreCache,
|
|
73
|
-
logger
|
|
74
|
-
}) => {
|
|
75
|
-
let token;
|
|
76
|
-
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
77
|
-
if (ssoSession) {
|
|
78
|
-
try {
|
|
79
|
-
const _token = await (0, import_token_providers.fromSso)({
|
|
80
|
-
profile,
|
|
81
|
-
filepath,
|
|
82
|
-
configFilepath,
|
|
83
|
-
ignoreCache
|
|
84
|
-
})();
|
|
85
|
-
token = {
|
|
86
|
-
accessToken: _token.token,
|
|
87
|
-
expiresAt: new Date(_token.expiration).toISOString()
|
|
88
|
-
};
|
|
89
|
-
} catch (e) {
|
|
90
|
-
throw new import_property_provider.CredentialsProviderError(e.message, {
|
|
91
|
-
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
92
|
-
logger
|
|
93
|
-
});
|
|
15
|
+
const SHOULD_FAIL_CREDENTIAL_CHAIN = false;
|
|
16
|
+
const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, profile, filepath, configFilepath, ignoreCache, logger, }) => {
|
|
17
|
+
let token;
|
|
18
|
+
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
19
|
+
if (ssoSession) {
|
|
20
|
+
try {
|
|
21
|
+
const _token = await tokenProviders.fromSso({
|
|
22
|
+
profile,
|
|
23
|
+
filepath,
|
|
24
|
+
configFilepath,
|
|
25
|
+
ignoreCache,
|
|
26
|
+
})();
|
|
27
|
+
token = {
|
|
28
|
+
accessToken: _token.token,
|
|
29
|
+
expiresAt: new Date(_token.expiration).toISOString(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
throw new propertyProvider.CredentialsProviderError(e.message, {
|
|
34
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
35
|
+
logger,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
94
38
|
}
|
|
95
|
-
|
|
39
|
+
else {
|
|
40
|
+
try {
|
|
41
|
+
token = await sharedIniFileLoader.getSSOTokenFromFile(ssoStartUrl);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
45
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
46
|
+
logger,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
51
|
+
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
52
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
53
|
+
logger,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const { accessToken } = token;
|
|
57
|
+
const { SSOClient, GetRoleCredentialsCommand } = await Promise.resolve().then(function () { return require('./loadSso-CVy8iqsZ.js'); });
|
|
58
|
+
const sso = ssoClient ||
|
|
59
|
+
new SSOClient(Object.assign({}, clientConfig ?? {}, {
|
|
60
|
+
logger: clientConfig?.logger ?? parentClientConfig?.logger,
|
|
61
|
+
region: clientConfig?.region ?? ssoRegion,
|
|
62
|
+
}));
|
|
63
|
+
let ssoResp;
|
|
96
64
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
65
|
+
ssoResp = await sso.send(new GetRoleCredentialsCommand({
|
|
66
|
+
accountId: ssoAccountId,
|
|
67
|
+
roleName: ssoRoleName,
|
|
68
|
+
accessToken,
|
|
69
|
+
}));
|
|
103
70
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
accountId
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
const {
|
|
135
|
-
roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {}
|
|
136
|
-
} = ssoResp;
|
|
137
|
-
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
138
|
-
throw new import_property_provider.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
139
|
-
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
140
|
-
logger
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const credentials = {
|
|
144
|
-
accessKeyId,
|
|
145
|
-
secretAccessKey,
|
|
146
|
-
sessionToken,
|
|
147
|
-
expiration: new Date(expiration),
|
|
148
|
-
...credentialScope && { credentialScope },
|
|
149
|
-
...accountId && { accountId }
|
|
150
|
-
};
|
|
151
|
-
if (ssoSession) {
|
|
152
|
-
(0, import_client.setCredentialFeature)(credentials, "CREDENTIALS_SSO", "s");
|
|
153
|
-
} else {
|
|
154
|
-
(0, import_client.setCredentialFeature)(credentials, "CREDENTIALS_SSO_LEGACY", "u");
|
|
155
|
-
}
|
|
156
|
-
return credentials;
|
|
157
|
-
}, "resolveSSOCredentials");
|
|
158
|
-
|
|
159
|
-
// src/validateSsoProfile.ts
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw new propertyProvider.CredentialsProviderError(e, {
|
|
73
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
74
|
+
logger,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {}, } = ssoResp;
|
|
78
|
+
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
79
|
+
throw new propertyProvider.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
80
|
+
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
81
|
+
logger,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const credentials = {
|
|
85
|
+
accessKeyId,
|
|
86
|
+
secretAccessKey,
|
|
87
|
+
sessionToken,
|
|
88
|
+
expiration: new Date(expiration),
|
|
89
|
+
...(credentialScope && { credentialScope }),
|
|
90
|
+
...(accountId && { accountId }),
|
|
91
|
+
};
|
|
92
|
+
if (ssoSession) {
|
|
93
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
client.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
|
|
97
|
+
}
|
|
98
|
+
return credentials;
|
|
99
|
+
};
|
|
160
100
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{ tryNextLink: false, logger }
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
return profile;
|
|
173
|
-
}, "validateSsoProfile");
|
|
101
|
+
const validateSsoProfile = (profile, logger) => {
|
|
102
|
+
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
103
|
+
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
104
|
+
throw new propertyProvider.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` +
|
|
105
|
+
`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
|
|
106
|
+
}
|
|
107
|
+
return profile;
|
|
108
|
+
};
|
|
174
109
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
110
|
+
const fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
111
|
+
init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
|
|
112
|
+
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
113
|
+
const { ssoClient } = init;
|
|
114
|
+
const profileName = sharedIniFileLoader.getProfileName({
|
|
115
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
116
|
+
});
|
|
117
|
+
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
118
|
+
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
|
119
|
+
const profile = profiles[profileName];
|
|
120
|
+
if (!profile) {
|
|
121
|
+
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
|
|
122
|
+
}
|
|
123
|
+
if (!isSsoProfile(profile)) {
|
|
124
|
+
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
|
|
125
|
+
logger: init.logger,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (profile?.sso_session) {
|
|
129
|
+
const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
|
|
130
|
+
const session = ssoSessions[profile.sso_session];
|
|
131
|
+
const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
|
|
132
|
+
if (ssoRegion && ssoRegion !== session.sso_region) {
|
|
133
|
+
throw new propertyProvider.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
|
|
134
|
+
tryNextLink: false,
|
|
135
|
+
logger: init.logger,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
139
|
+
throw new propertyProvider.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
|
|
140
|
+
tryNextLink: false,
|
|
141
|
+
logger: init.logger,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
profile.sso_region = session.sso_region;
|
|
145
|
+
profile.sso_start_url = session.sso_start_url;
|
|
146
|
+
}
|
|
147
|
+
const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
|
|
148
|
+
return resolveSSOCredentials({
|
|
149
|
+
ssoStartUrl: sso_start_url,
|
|
150
|
+
ssoSession: sso_session,
|
|
151
|
+
ssoAccountId: sso_account_id,
|
|
152
|
+
ssoRegion: sso_region,
|
|
153
|
+
ssoRoleName: sso_role_name,
|
|
154
|
+
ssoClient: ssoClient,
|
|
155
|
+
clientConfig: init.clientConfig,
|
|
156
|
+
parentClientConfig: init.parentClientConfig,
|
|
157
|
+
profile: profileName,
|
|
158
|
+
filepath: init.filepath,
|
|
159
|
+
configFilepath: init.configFilepath,
|
|
160
|
+
ignoreCache: init.ignoreCache,
|
|
161
|
+
logger: init.logger,
|
|
162
|
+
});
|
|
188
163
|
}
|
|
189
|
-
if (!
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
164
|
+
else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
|
|
165
|
+
throw new propertyProvider.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " +
|
|
166
|
+
'"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
|
|
193
167
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
168
|
+
else {
|
|
169
|
+
return resolveSSOCredentials({
|
|
170
|
+
ssoStartUrl,
|
|
171
|
+
ssoSession,
|
|
172
|
+
ssoAccountId,
|
|
173
|
+
ssoRegion,
|
|
174
|
+
ssoRoleName,
|
|
175
|
+
ssoClient,
|
|
176
|
+
clientConfig: init.clientConfig,
|
|
177
|
+
parentClientConfig: init.parentClientConfig,
|
|
178
|
+
profile: profileName,
|
|
179
|
+
filepath: init.filepath,
|
|
180
|
+
configFilepath: init.configFilepath,
|
|
181
|
+
ignoreCache: init.ignoreCache,
|
|
182
|
+
logger: init.logger,
|
|
202
183
|
});
|
|
203
|
-
}
|
|
204
|
-
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
205
|
-
throw new import_property_provider.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
|
|
206
|
-
tryNextLink: false,
|
|
207
|
-
logger: init.logger
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
profile.sso_region = session.sso_region;
|
|
211
|
-
profile.sso_start_url = session.sso_start_url;
|
|
212
184
|
}
|
|
213
|
-
|
|
214
|
-
profile,
|
|
215
|
-
init.logger
|
|
216
|
-
);
|
|
217
|
-
return resolveSSOCredentials({
|
|
218
|
-
ssoStartUrl: sso_start_url,
|
|
219
|
-
ssoSession: sso_session,
|
|
220
|
-
ssoAccountId: sso_account_id,
|
|
221
|
-
ssoRegion: sso_region,
|
|
222
|
-
ssoRoleName: sso_role_name,
|
|
223
|
-
ssoClient,
|
|
224
|
-
clientConfig: init.clientConfig,
|
|
225
|
-
parentClientConfig: init.parentClientConfig,
|
|
226
|
-
profile: profileName,
|
|
227
|
-
filepath: init.filepath,
|
|
228
|
-
configFilepath: init.configFilepath,
|
|
229
|
-
ignoreCache: init.ignoreCache,
|
|
230
|
-
logger: init.logger
|
|
231
|
-
});
|
|
232
|
-
} else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
|
|
233
|
-
throw new import_property_provider.CredentialsProviderError(
|
|
234
|
-
'Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',
|
|
235
|
-
{ tryNextLink: false, logger: init.logger }
|
|
236
|
-
);
|
|
237
|
-
} else {
|
|
238
|
-
return resolveSSOCredentials({
|
|
239
|
-
ssoStartUrl,
|
|
240
|
-
ssoSession,
|
|
241
|
-
ssoAccountId,
|
|
242
|
-
ssoRegion,
|
|
243
|
-
ssoRoleName,
|
|
244
|
-
ssoClient,
|
|
245
|
-
clientConfig: init.clientConfig,
|
|
246
|
-
parentClientConfig: init.parentClientConfig,
|
|
247
|
-
profile: profileName,
|
|
248
|
-
filepath: init.filepath,
|
|
249
|
-
configFilepath: init.configFilepath,
|
|
250
|
-
ignoreCache: init.ignoreCache,
|
|
251
|
-
logger: init.logger
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}, "fromSSO");
|
|
255
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
256
|
-
|
|
257
|
-
0 && (module.exports = {
|
|
258
|
-
fromSSO,
|
|
259
|
-
isSsoProfile,
|
|
260
|
-
validateSsoProfile
|
|
261
|
-
});
|
|
185
|
+
};
|
|
262
186
|
|
|
187
|
+
exports.fromSSO = fromSSO;
|
|
188
|
+
exports.isSsoProfile = isSsoProfile;
|
|
189
|
+
exports.validateSsoProfile = validateSsoProfile;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clientSso = require('@aws-sdk/client-sso');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "GetRoleCredentialsCommand", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return clientSso.GetRoleCredentialsCommand; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "SSOClient", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return clientSso.SSOClient; }
|
|
14
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-sso",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.907.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",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/client-sso": "3.
|
|
30
|
-
"@aws-sdk/core": "3.
|
|
31
|
-
"@aws-sdk/token-providers": "3.
|
|
29
|
+
"@aws-sdk/client-sso": "3.907.0",
|
|
30
|
+
"@aws-sdk/core": "3.907.0",
|
|
31
|
+
"@aws-sdk/token-providers": "3.907.0",
|
|
32
32
|
"@aws-sdk/types": "3.901.0",
|
|
33
33
|
"@smithy/property-provider": "^4.2.0",
|
|
34
34
|
"@smithy/shared-ini-file-loader": "^4.3.0",
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fromTokenFile = require('./fromTokenFile');
|
|
4
|
+
var fromWebToken = require('./fromWebToken');
|
|
16
5
|
|
|
17
|
-
// src/index.ts
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("././fromTokenFile"), module.exports);
|
|
21
|
-
__reExport(index_exports, require("././fromWebToken"), module.exports);
|
|
22
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
23
6
|
|
|
24
|
-
0 && (module.exports = {
|
|
25
|
-
fromTokenFile,
|
|
26
|
-
fromWebToken
|
|
27
|
-
});
|
|
28
7
|
|
|
8
|
+
Object.keys(fromTokenFile).forEach(function (k) {
|
|
9
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return fromTokenFile[k]; }
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
Object.keys(fromWebToken).forEach(function (k) {
|
|
15
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return fromWebToken[k]; }
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-web-identity",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.907.0",
|
|
4
4
|
"description": "AWS credential provider that calls STS assumeRole for temporary AWS credentials",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@aws-sdk/core": "3.
|
|
38
|
-
"@aws-sdk/nested-clients": "3.
|
|
37
|
+
"@aws-sdk/core": "3.907.0",
|
|
38
|
+
"@aws-sdk/nested-clients": "3.907.0",
|
|
39
39
|
"@aws-sdk/types": "3.901.0",
|
|
40
40
|
"@smithy/property-provider": "^4.2.0",
|
|
41
41
|
"@smithy/shared-ini-file-loader": "^4.3.0",
|