@aws-sdk/client-sts 3.35.0 → 3.38.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/STS.js +0 -8
  3. package/dist-cjs/STSClient.js +0 -13
  4. package/dist-cjs/commands/AssumeRoleCommand.js +0 -108
  5. package/dist-cjs/commands/AssumeRoleWithSAMLCommand.js +0 -156
  6. package/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js +0 -160
  7. package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js +0 -60
  8. package/dist-cjs/commands/GetAccessKeyInfoCommand.js +0 -42
  9. package/dist-cjs/commands/GetCallerIdentityCommand.js +0 -34
  10. package/dist-cjs/commands/GetFederationTokenCommand.js +0 -163
  11. package/dist-cjs/commands/GetSessionTokenCommand.js +0 -76
  12. package/dist-cjs/commands/index.js +11 -0
  13. package/dist-cjs/defaultRoleAssumers.js +0 -17
  14. package/dist-cjs/defaultStsRoleAssumers.js +0 -21
  15. package/dist-cjs/endpoints.js +1 -2
  16. package/dist-cjs/index.js +3 -11
  17. package/dist-cjs/models/index.js +0 -1
  18. package/dist-cjs/models/models_0.js +0 -88
  19. package/dist-cjs/protocols/Aws_query.js +0 -3
  20. package/dist-cjs/runtimeConfig.browser.js +1 -6
  21. package/dist-cjs/runtimeConfig.js +3 -8
  22. package/dist-cjs/runtimeConfig.native.js +0 -4
  23. package/dist-cjs/runtimeConfig.shared.js +0 -4
  24. package/dist-es/STS.js +0 -1
  25. package/dist-es/STSClient.js +0 -1
  26. package/dist-es/commands/AssumeRoleCommand.js +0 -1
  27. package/dist-es/commands/AssumeRoleWithSAMLCommand.js +0 -1
  28. package/dist-es/commands/AssumeRoleWithWebIdentityCommand.js +0 -1
  29. package/dist-es/commands/DecodeAuthorizationMessageCommand.js +0 -1
  30. package/dist-es/commands/GetAccessKeyInfoCommand.js +0 -1
  31. package/dist-es/commands/GetCallerIdentityCommand.js +0 -1
  32. package/dist-es/commands/GetFederationTokenCommand.js +0 -1
  33. package/dist-es/commands/GetSessionTokenCommand.js +0 -1
  34. package/dist-es/commands/index.js +8 -0
  35. package/dist-es/defaultRoleAssumers.js +0 -1
  36. package/dist-es/defaultStsRoleAssumers.js +0 -1
  37. package/dist-es/endpoints.js +1 -2
  38. package/dist-es/index.js +3 -11
  39. package/dist-es/models/index.js +0 -1
  40. package/dist-es/models/models_0.js +0 -1
  41. package/dist-es/protocols/Aws_query.js +0 -1
  42. package/dist-es/runtimeConfig.browser.js +1 -2
  43. package/dist-es/runtimeConfig.js +3 -4
  44. package/dist-es/runtimeConfig.native.js +0 -1
  45. package/dist-es/runtimeConfig.shared.js +0 -1
  46. package/dist-types/commands/index.d.ts +8 -0
  47. package/dist-types/index.d.ts +3 -10
  48. package/dist-types/ts3.4/STS.d.ts +9 -630
  49. package/dist-types/ts3.4/STSClient.d.ts +24 -93
  50. package/dist-types/ts3.4/commands/AssumeRoleCommand.d.ts +2 -103
  51. package/dist-types/ts3.4/commands/AssumeRoleWithSAMLCommand.d.ts +2 -151
  52. package/dist-types/ts3.4/commands/AssumeRoleWithWebIdentityCommand.d.ts +2 -155
  53. package/dist-types/ts3.4/commands/DecodeAuthorizationMessageCommand.d.ts +2 -55
  54. package/dist-types/ts3.4/commands/GetAccessKeyInfoCommand.d.ts +2 -37
  55. package/dist-types/ts3.4/commands/GetCallerIdentityCommand.d.ts +2 -29
  56. package/dist-types/ts3.4/commands/GetFederationTokenCommand.d.ts +2 -158
  57. package/dist-types/ts3.4/commands/GetSessionTokenCommand.d.ts +2 -71
  58. package/dist-types/ts3.4/commands/index.d.ts +8 -0
  59. package/dist-types/ts3.4/defaultRoleAssumers.d.ts +3 -14
  60. package/dist-types/ts3.4/defaultStsRoleAssumers.d.ts +6 -25
  61. package/dist-types/ts3.4/index.d.ts +3 -10
  62. package/dist-types/ts3.4/models/models_0.d.ts +123 -948
  63. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  64. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  65. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  66. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  67. package/package.json +33 -30
  68. package/dist-cjs/STS.js.map +0 -1
  69. package/dist-cjs/STSClient.js.map +0 -1
  70. package/dist-cjs/commands/AssumeRoleCommand.js.map +0 -1
  71. package/dist-cjs/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
  72. package/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
  73. package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
  74. package/dist-cjs/commands/GetAccessKeyInfoCommand.js.map +0 -1
  75. package/dist-cjs/commands/GetCallerIdentityCommand.js.map +0 -1
  76. package/dist-cjs/commands/GetFederationTokenCommand.js.map +0 -1
  77. package/dist-cjs/commands/GetSessionTokenCommand.js.map +0 -1
  78. package/dist-cjs/defaultRoleAssumers.js.map +0 -1
  79. package/dist-cjs/defaultStsRoleAssumers.js.map +0 -1
  80. package/dist-cjs/endpoints.js.map +0 -1
  81. package/dist-cjs/index.js.map +0 -1
  82. package/dist-cjs/models/index.js.map +0 -1
  83. package/dist-cjs/models/models_0.js.map +0 -1
  84. package/dist-cjs/protocols/Aws_query.js.map +0 -1
  85. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  86. package/dist-cjs/runtimeConfig.js.map +0 -1
  87. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  88. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  89. package/dist-es/STS.js.map +0 -1
  90. package/dist-es/STSClient.js.map +0 -1
  91. package/dist-es/commands/AssumeRoleCommand.js.map +0 -1
  92. package/dist-es/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
  93. package/dist-es/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
  94. package/dist-es/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
  95. package/dist-es/commands/GetAccessKeyInfoCommand.js.map +0 -1
  96. package/dist-es/commands/GetCallerIdentityCommand.js.map +0 -1
  97. package/dist-es/commands/GetFederationTokenCommand.js.map +0 -1
  98. package/dist-es/commands/GetSessionTokenCommand.js.map +0 -1
  99. package/dist-es/defaultRoleAssumers.js.map +0 -1
  100. package/dist-es/defaultStsRoleAssumers.js.map +0 -1
  101. package/dist-es/endpoints.js.map +0 -1
  102. package/dist-es/index.js.map +0 -1
  103. package/dist-es/models/index.js.map +0 -1
  104. package/dist-es/models/models_0.js.map +0 -1
  105. package/dist-es/protocols/Aws_query.js.map +0 -1
  106. package/dist-es/runtimeConfig.browser.js.map +0 -1
  107. package/dist-es/runtimeConfig.js.map +0 -1
  108. package/dist-es/runtimeConfig.native.js.map +0 -1
  109. package/dist-es/runtimeConfig.shared.js.map +0 -1
  110. package/jest.config.js +0 -4
  111. package/src/STS.ts +0 -897
  112. package/src/STSClient.ts +0 -264
  113. package/src/commands/AssumeRoleCommand.ts +0 -177
  114. package/src/commands/AssumeRoleWithSAMLCommand.ts +0 -226
  115. package/src/commands/AssumeRoleWithWebIdentityCommand.ts +0 -233
  116. package/src/commands/DecodeAuthorizationMessageCommand.ts +0 -135
  117. package/src/commands/GetAccessKeyInfoCommand.ts +0 -114
  118. package/src/commands/GetCallerIdentityCommand.ts +0 -106
  119. package/src/commands/GetFederationTokenCommand.ts +0 -235
  120. package/src/commands/GetSessionTokenCommand.ts +0 -148
  121. package/src/defaultRoleAssumers.ts +0 -41
  122. package/src/defaultStsRoleAssumers.ts +0 -126
  123. package/src/endpoints.ts +0 -91
  124. package/src/index.ts +0 -12
  125. package/src/models/index.ts +0 -1
  126. package/src/models/models_0.ts +0 -1361
  127. package/src/protocols/Aws_query.ts +0 -1514
  128. package/src/runtimeConfig.browser.ts +0 -41
  129. package/src/runtimeConfig.native.ts +0 -17
  130. package/src/runtimeConfig.shared.ts +0 -17
  131. package/src/runtimeConfig.ts +0 -46
  132. package/test/defaultRoleAssumers.spec.ts +0 -149
  133. package/tsconfig.es.json +0 -10
  134. package/tsconfig.json +0 -33
  135. package/tsconfig.types.json +0 -9
@@ -1,235 +0,0 @@
1
- import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2
- import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
3
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4
- import { Command as $Command } from "@aws-sdk/smithy-client";
5
- import {
6
- FinalizeHandlerArguments,
7
- Handler,
8
- HandlerExecutionContext,
9
- HttpHandlerOptions as __HttpHandlerOptions,
10
- MetadataBearer as __MetadataBearer,
11
- MiddlewareStack,
12
- SerdeContext as __SerdeContext,
13
- } from "@aws-sdk/types";
14
-
15
- import { GetFederationTokenRequest, GetFederationTokenResponse } from "../models/models_0";
16
- import {
17
- deserializeAws_queryGetFederationTokenCommand,
18
- serializeAws_queryGetFederationTokenCommand,
19
- } from "../protocols/Aws_query";
20
- import { ServiceInputTypes, ServiceOutputTypes, STSClientResolvedConfig } from "../STSClient";
21
-
22
- export interface GetFederationTokenCommandInput extends GetFederationTokenRequest {}
23
- export interface GetFederationTokenCommandOutput extends GetFederationTokenResponse, __MetadataBearer {}
24
-
25
- /**
26
- * <p>Returns a set of temporary security credentials (consisting of an access key ID, a
27
- * secret access key, and a security token) for a federated user. A typical use is in a proxy
28
- * application that gets temporary security credentials on behalf of distributed applications
29
- * inside a corporate network. You must call the <code>GetFederationToken</code> operation
30
- * using the long-term security credentials of an IAM user. As a result, this call is
31
- * appropriate in contexts where those credentials can be safely stored, usually in a
32
- * server-based application. For a comparison of <code>GetFederationToken</code> with the
33
- * other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting Temporary Security
34
- * Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the
35
- * STS API operations</a> in the <i>IAM User Guide</i>.</p>
36
- * <note>
37
- * <p>You can create a mobile-based or browser-based app that can authenticate users using
38
- * a web identity provider like Login with Amazon, Facebook, Google, or an OpenID
39
- * Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or
40
- * <code>AssumeRoleWithWebIdentity</code>. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a> in the
41
- * <i>IAM User Guide</i>.</p>
42
- * </note>
43
- * <p>You can also call <code>GetFederationToken</code> using the security credentials of an
44
- * Amazon Web Services account root user, but we do not recommend it. Instead, we recommend that you create
45
- * an IAM user for the purpose of the proxy application. Then attach a policy to the IAM
46
- * user that limits federated users to only the actions and resources that they need to
47
- * access. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html">IAM Best Practices</a> in the
48
- * <i>IAM User Guide</i>. </p>
49
- * <p>
50
- * <b>Session duration</b>
51
- * </p>
52
- * <p>The temporary credentials are valid for the specified duration, from 900 seconds (15
53
- * minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is
54
- * 43,200 seconds (12 hours). Temporary credentials that are obtained by using Amazon Web Services account
55
- * root user credentials have a maximum duration of 3,600 seconds (1 hour).</p>
56
- * <p>
57
- * <b>Permissions</b>
58
- * </p>
59
- * <p>You can use the temporary credentials created by <code>GetFederationToken</code> in any
60
- * Amazon Web Services service except the following:</p>
61
- * <ul>
62
- * <li>
63
- * <p>You cannot call any IAM operations using the CLI or the Amazon Web Services API. </p>
64
- * </li>
65
- * <li>
66
- * <p>You cannot call any STS operations except <code>GetCallerIdentity</code>.</p>
67
- * </li>
68
- * </ul>
69
- * <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to
70
- * this operation. You can pass a single JSON policy document to use as an inline session
71
- * policy. You can also specify up to 10 managed policies to use as managed session policies.
72
- * The plaintext that you use for both inline and managed session policies can't exceed 2,048
73
- * characters.</p>
74
- * <p>Though the session policy parameters are optional, if you do not pass a policy, then the
75
- * resulting federated user session has no permissions. When you pass session policies, the
76
- * session permissions are the intersection of the IAM user policies and the session
77
- * policies that you pass. This gives you a way to further restrict the permissions for a
78
- * federated user. You cannot use session policies to grant more permissions than those that
79
- * are defined in the permissions policy of the IAM user. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session
80
- * Policies</a> in the <i>IAM User Guide</i>. For information about
81
- * using <code>GetFederationToken</code> to create temporary security credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken">GetFederationToken—Federation Through a Custom Identity Broker</a>. </p>
82
- * <p>You can use the credentials to access a resource that has a resource-based policy. If
83
- * that policy specifically references the federated user session in the
84
- * <code>Principal</code> element of the policy, the session has the permissions allowed by
85
- * the policy. These permissions are granted in addition to the permissions granted by the
86
- * session policies.</p>
87
- * <p>
88
- * <b>Tags</b>
89
- * </p>
90
- * <p>(Optional) You can pass tag key-value pairs to your session. These are called session
91
- * tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in the
92
- * <i>IAM User Guide</i>.</p>
93
- * <note>
94
- * <p>You can create a mobile-based or browser-based app that can authenticate users
95
- * using a web identity provider like Login with Amazon, Facebook, Google, or an OpenID
96
- * Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or
97
- * <code>AssumeRoleWithWebIdentity</code>. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity">Federation Through a Web-based Identity Provider</a> in the
98
- * <i>IAM User Guide</i>.</p>
99
- * </note>
100
- * <p>You can also call <code>GetFederationToken</code> using the security credentials of an
101
- * Amazon Web Services account root user, but we do not recommend it. Instead, we recommend that you
102
- * create an IAM user for the purpose of the proxy application. Then attach a policy to
103
- * the IAM user that limits federated users to only the actions and resources that they
104
- * need to access. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html">IAM Best Practices</a> in the
105
- * <i>IAM User Guide</i>. </p>
106
- * <p>
107
- * <b>Session duration</b>
108
- * </p>
109
- * <p>The temporary credentials are valid for the specified duration, from 900 seconds (15
110
- * minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is
111
- * 43,200 seconds (12 hours). Temporary credentials that are obtained by using Amazon Web Services
112
- * account root user credentials have a maximum duration of 3,600 seconds (1 hour).</p>
113
- * <p>
114
- * <b>Permissions</b>
115
- * </p>
116
- * <p>You can use the temporary credentials created by <code>GetFederationToken</code> in
117
- * any Amazon Web Services service except the following:</p>
118
- * <ul>
119
- * <li>
120
- * <p>You cannot call any IAM operations using the CLI or the Amazon Web Services API.
121
- * </p>
122
- * </li>
123
- * <li>
124
- * <p>You cannot call any STS operations except
125
- * <code>GetCallerIdentity</code>.</p>
126
- * </li>
127
- * </ul>
128
- * <p>You must pass an inline or managed <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">session policy</a> to
129
- * this operation. You can pass a single JSON policy document to use as an inline session
130
- * policy. You can also specify up to 10 managed policies to use as managed session
131
- * policies. The plain text that you use for both inline and managed session policies can't
132
- * exceed 2,048 characters.</p>
133
- * <p>Though the session policy parameters are optional, if you do not pass a policy, then
134
- * the resulting federated user session has no permissions. When you pass session policies,
135
- * the session permissions are the intersection of the IAM user policies and the session
136
- * policies that you pass. This gives you a way to further restrict the permissions for a
137
- * federated user. You cannot use session policies to grant more permissions than those
138
- * that are defined in the permissions policy of the IAM user. For more information, see
139
- * <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a>
140
- * in the <i>IAM User Guide</i>. For information about using
141
- * <code>GetFederationToken</code> to create temporary security credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken">GetFederationToken—Federation Through a Custom Identity Broker</a>. </p>
142
- * <p>You can use the credentials to access a resource that has a resource-based policy. If
143
- * that policy specifically references the federated user session in the
144
- * <code>Principal</code> element of the policy, the session has the permissions
145
- * allowed by the policy. These permissions are granted in addition to the permissions
146
- * granted by the session policies.</p>
147
- * <p>
148
- * <b>Tags</b>
149
- * </p>
150
- * <p>(Optional) You can pass tag key-value pairs to your session. These are called session
151
- * tags. For more information about session tags, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html">Passing Session Tags in STS</a> in
152
- * the <i>IAM User Guide</i>.</p>
153
- * <p>An administrator must grant you the permissions necessary to pass session tags. The
154
- * administrator can also create granular permissions to allow you to pass only specific
155
- * session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using
156
- * Tags for Attribute-Based Access Control</a> in the
157
- * <i>IAM User Guide</i>.</p>
158
- * <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you
159
- * cannot have separate <code>Department</code> and <code>department</code> tag keys.
160
- * Assume that the user that you are federating has the
161
- * <code>Department</code>=<code>Marketing</code> tag and you pass the
162
- * <code>department</code>=<code>engineering</code> session tag.
163
- * <code>Department</code> and <code>department</code> are not saved as separate tags,
164
- * and the session tag passed in the request takes precedence over the user tag.</p>
165
- * @example
166
- * Use a bare-bones client and the command you need to make an API call.
167
- * ```javascript
168
- * import { STSClient, GetFederationTokenCommand } from "@aws-sdk/client-sts"; // ES Modules import
169
- * // const { STSClient, GetFederationTokenCommand } = require("@aws-sdk/client-sts"); // CommonJS import
170
- * const client = new STSClient(config);
171
- * const command = new GetFederationTokenCommand(input);
172
- * const response = await client.send(command);
173
- * ```
174
- *
175
- * @see {@link GetFederationTokenCommandInput} for command's `input` shape.
176
- * @see {@link GetFederationTokenCommandOutput} for command's `response` shape.
177
- * @see {@link STSClientResolvedConfig | config} for command's `input` shape.
178
- *
179
- */
180
- export class GetFederationTokenCommand extends $Command<
181
- GetFederationTokenCommandInput,
182
- GetFederationTokenCommandOutput,
183
- STSClientResolvedConfig
184
- > {
185
- // Start section: command_properties
186
- // End section: command_properties
187
-
188
- constructor(readonly input: GetFederationTokenCommandInput) {
189
- // Start section: command_constructor
190
- super();
191
- // End section: command_constructor
192
- }
193
-
194
- /**
195
- * @internal
196
- */
197
- resolveMiddleware(
198
- clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
199
- configuration: STSClientResolvedConfig,
200
- options?: __HttpHandlerOptions
201
- ): Handler<GetFederationTokenCommandInput, GetFederationTokenCommandOutput> {
202
- this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
203
- this.middlewareStack.use(getAwsAuthPlugin(configuration));
204
-
205
- const stack = clientStack.concat(this.middlewareStack);
206
-
207
- const { logger } = configuration;
208
- const clientName = "STSClient";
209
- const commandName = "GetFederationTokenCommand";
210
- const handlerExecutionContext: HandlerExecutionContext = {
211
- logger,
212
- clientName,
213
- commandName,
214
- inputFilterSensitiveLog: GetFederationTokenRequest.filterSensitiveLog,
215
- outputFilterSensitiveLog: GetFederationTokenResponse.filterSensitiveLog,
216
- };
217
- const { requestHandler } = configuration;
218
- return stack.resolve(
219
- (request: FinalizeHandlerArguments<any>) =>
220
- requestHandler.handle(request.request as __HttpRequest, options || {}),
221
- handlerExecutionContext
222
- );
223
- }
224
-
225
- private serialize(input: GetFederationTokenCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
226
- return serializeAws_queryGetFederationTokenCommand(input, context);
227
- }
228
-
229
- private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetFederationTokenCommandOutput> {
230
- return deserializeAws_queryGetFederationTokenCommand(output, context);
231
- }
232
-
233
- // Start section: command_body_extra
234
- // End section: command_body_extra
235
- }
@@ -1,148 +0,0 @@
1
- import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2
- import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
3
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4
- import { Command as $Command } from "@aws-sdk/smithy-client";
5
- import {
6
- FinalizeHandlerArguments,
7
- Handler,
8
- HandlerExecutionContext,
9
- HttpHandlerOptions as __HttpHandlerOptions,
10
- MetadataBearer as __MetadataBearer,
11
- MiddlewareStack,
12
- SerdeContext as __SerdeContext,
13
- } from "@aws-sdk/types";
14
-
15
- import { GetSessionTokenRequest, GetSessionTokenResponse } from "../models/models_0";
16
- import {
17
- deserializeAws_queryGetSessionTokenCommand,
18
- serializeAws_queryGetSessionTokenCommand,
19
- } from "../protocols/Aws_query";
20
- import { ServiceInputTypes, ServiceOutputTypes, STSClientResolvedConfig } from "../STSClient";
21
-
22
- export interface GetSessionTokenCommandInput extends GetSessionTokenRequest {}
23
- export interface GetSessionTokenCommandOutput extends GetSessionTokenResponse, __MetadataBearer {}
24
-
25
- /**
26
- * <p>Returns a set of temporary credentials for an Amazon Web Services account or IAM user. The
27
- * credentials consist of an access key ID, a secret access key, and a security token.
28
- * Typically, you use <code>GetSessionToken</code> if you want to use MFA to protect
29
- * programmatic calls to specific Amazon Web Services API operations like Amazon EC2 <code>StopInstances</code>.
30
- * MFA-enabled IAM users would need to call <code>GetSessionToken</code> and submit an MFA
31
- * code that is associated with their MFA device. Using the temporary security credentials
32
- * that are returned from the call, IAM users can then make programmatic calls to API
33
- * operations that require MFA authentication. If you do not supply a correct MFA code, then
34
- * the API returns an access denied error. For a comparison of <code>GetSessionToken</code>
35
- * with the other API operations that produce temporary credentials, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html">Requesting
36
- * Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the
37
- * STS API operations</a> in the <i>IAM User Guide</i>.</p>
38
- * <p>
39
- * <b>Session Duration</b>
40
- * </p>
41
- * <p>The <code>GetSessionToken</code> operation must be called by using the long-term Amazon Web Services
42
- * security credentials of the Amazon Web Services account root user or an IAM user. Credentials that are
43
- * created by IAM users are valid for the duration that you specify. This duration can range
44
- * from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default
45
- * of 43,200 seconds (12 hours). Credentials based on account credentials can range from 900
46
- * seconds (15 minutes) up to 3,600 seconds (1 hour), with a default of 1 hour. </p>
47
- * <p>
48
- * <b>Permissions</b>
49
- * </p>
50
- * <p>The temporary security credentials created by <code>GetSessionToken</code> can be used
51
- * to make API calls to any Amazon Web Services service with the following exceptions:</p>
52
- * <ul>
53
- * <li>
54
- * <p>You cannot call any IAM API operations unless MFA authentication information is
55
- * included in the request.</p>
56
- * </li>
57
- * <li>
58
- * <p>You cannot call any STS API <i>except</i>
59
- * <code>AssumeRole</code> or <code>GetCallerIdentity</code>.</p>
60
- * </li>
61
- * </ul>
62
- * <note>
63
- * <p>We recommend that you do not call <code>GetSessionToken</code> with Amazon Web Services account
64
- * root user credentials. Instead, follow our <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users">best practices</a> by
65
- * creating one or more IAM users, giving them the necessary permissions, and using IAM
66
- * users for everyday interaction with Amazon Web Services. </p>
67
- * </note>
68
- * <p>The credentials that are returned by <code>GetSessionToken</code> are based on
69
- * permissions associated with the user whose credentials were used to call the operation. If
70
- * <code>GetSessionToken</code> is called using Amazon Web Services account root user credentials, the
71
- * temporary credentials have root user permissions. Similarly, if
72
- * <code>GetSessionToken</code> is called using the credentials of an IAM user, the
73
- * temporary credentials have the same permissions as the IAM user. </p>
74
- * <p>For more information about using <code>GetSessionToken</code> to create temporary
75
- * credentials, go to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken">Temporary
76
- * Credentials for Users in Untrusted Environments</a> in the
77
- * <i>IAM User Guide</i>. </p>
78
- * @example
79
- * Use a bare-bones client and the command you need to make an API call.
80
- * ```javascript
81
- * import { STSClient, GetSessionTokenCommand } from "@aws-sdk/client-sts"; // ES Modules import
82
- * // const { STSClient, GetSessionTokenCommand } = require("@aws-sdk/client-sts"); // CommonJS import
83
- * const client = new STSClient(config);
84
- * const command = new GetSessionTokenCommand(input);
85
- * const response = await client.send(command);
86
- * ```
87
- *
88
- * @see {@link GetSessionTokenCommandInput} for command's `input` shape.
89
- * @see {@link GetSessionTokenCommandOutput} for command's `response` shape.
90
- * @see {@link STSClientResolvedConfig | config} for command's `input` shape.
91
- *
92
- */
93
- export class GetSessionTokenCommand extends $Command<
94
- GetSessionTokenCommandInput,
95
- GetSessionTokenCommandOutput,
96
- STSClientResolvedConfig
97
- > {
98
- // Start section: command_properties
99
- // End section: command_properties
100
-
101
- constructor(readonly input: GetSessionTokenCommandInput) {
102
- // Start section: command_constructor
103
- super();
104
- // End section: command_constructor
105
- }
106
-
107
- /**
108
- * @internal
109
- */
110
- resolveMiddleware(
111
- clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
112
- configuration: STSClientResolvedConfig,
113
- options?: __HttpHandlerOptions
114
- ): Handler<GetSessionTokenCommandInput, GetSessionTokenCommandOutput> {
115
- this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
116
- this.middlewareStack.use(getAwsAuthPlugin(configuration));
117
-
118
- const stack = clientStack.concat(this.middlewareStack);
119
-
120
- const { logger } = configuration;
121
- const clientName = "STSClient";
122
- const commandName = "GetSessionTokenCommand";
123
- const handlerExecutionContext: HandlerExecutionContext = {
124
- logger,
125
- clientName,
126
- commandName,
127
- inputFilterSensitiveLog: GetSessionTokenRequest.filterSensitiveLog,
128
- outputFilterSensitiveLog: GetSessionTokenResponse.filterSensitiveLog,
129
- };
130
- const { requestHandler } = configuration;
131
- return stack.resolve(
132
- (request: FinalizeHandlerArguments<any>) =>
133
- requestHandler.handle(request.request as __HttpRequest, options || {}),
134
- handlerExecutionContext
135
- );
136
- }
137
-
138
- private serialize(input: GetSessionTokenCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
139
- return serializeAws_queryGetSessionTokenCommand(input, context);
140
- }
141
-
142
- private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetSessionTokenCommandOutput> {
143
- return deserializeAws_queryGetSessionTokenCommand(output, context);
144
- }
145
-
146
- // Start section: command_body_extra
147
- // End section: command_body_extra
148
- }
@@ -1,41 +0,0 @@
1
- // Please do not touch this file. It's generated from template in:
2
- // https://github.com/aws/aws-sdk-js-v3/blob/main/codegen/smithy-aws-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/sts-client-defaultRoleAssumers.ts
3
- import {
4
- DefaultCredentialProvider,
5
- getDefaultRoleAssumer as StsGetDefaultRoleAssumer,
6
- getDefaultRoleAssumerWithWebIdentity as StsGetDefaultRoleAssumerWithWebIdentity,
7
- RoleAssumer,
8
- RoleAssumerWithWebIdentity,
9
- } from "./defaultStsRoleAssumers";
10
- import { STSClient, STSClientConfig } from "./STSClient";
11
-
12
- /**
13
- * The default role assumer that used by credential providers when sts:AssumeRole API is needed.
14
- */
15
- export const getDefaultRoleAssumer = (
16
- stsOptions: Pick<STSClientConfig, "logger" | "region" | "requestHandler"> = {}
17
- ): RoleAssumer => StsGetDefaultRoleAssumer(stsOptions, STSClient);
18
-
19
- /**
20
- * The default role assumer that used by credential providers when sts:AssumeRoleWithWebIdentity API is needed.
21
- */
22
- export const getDefaultRoleAssumerWithWebIdentity = (
23
- stsOptions: Pick<STSClientConfig, "logger" | "region" | "requestHandler"> = {}
24
- ): RoleAssumerWithWebIdentity => StsGetDefaultRoleAssumerWithWebIdentity(stsOptions, STSClient);
25
-
26
- /**
27
- * The default credential providers depend STS client to assume role with desired API: sts:assumeRole,
28
- * sts:assumeRoleWithWebIdentity, etc. This function decorates the default credential provider with role assumers which
29
- * encapsulates the process of calling STS commands. This can only be imported by AWS client packages to avoid circular
30
- * dependencies.
31
- *
32
- * @internal
33
- */
34
- export const decorateDefaultCredentialProvider =
35
- (provider: DefaultCredentialProvider): DefaultCredentialProvider =>
36
- (input: any) =>
37
- provider({
38
- roleAssumer: getDefaultRoleAssumer(input),
39
- roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input),
40
- ...input,
41
- });
@@ -1,126 +0,0 @@
1
- // Please do not touch this file. It's generated from template in:
2
- // https://github.com/aws/aws-sdk-js-v3/blob/main/codegen/smithy-aws-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/sts-client-defaultStsRoleAssumers.ts
3
- import { Credentials, Provider } from "@aws-sdk/types";
4
-
5
- import { AssumeRoleCommand, AssumeRoleCommandInput } from "./commands/AssumeRoleCommand";
6
- import {
7
- AssumeRoleWithWebIdentityCommand,
8
- AssumeRoleWithWebIdentityCommandInput,
9
- } from "./commands/AssumeRoleWithWebIdentityCommand";
10
- import type { STSClient, STSClientConfig, STSClientResolvedConfig } from "./STSClient";
11
-
12
- /**
13
- * @internal
14
- */
15
- export type RoleAssumer = (sourceCreds: Credentials, params: AssumeRoleCommandInput) => Promise<Credentials>;
16
-
17
- const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
18
-
19
- /**
20
- * Inject the fallback STS region of us-east-1.
21
- */
22
- const decorateDefaultRegion = (region: string | Provider<string> | undefined): string | Provider<string> => {
23
- if (typeof region !== "function") {
24
- return region === undefined ? ASSUME_ROLE_DEFAULT_REGION : region;
25
- }
26
- return async () => {
27
- try {
28
- return await region();
29
- } catch (e) {
30
- return ASSUME_ROLE_DEFAULT_REGION;
31
- }
32
- };
33
- };
34
-
35
- /**
36
- * The default role assumer that used by credential providers when sts:AssumeRole API is needed.
37
- * @internal
38
- */
39
- export const getDefaultRoleAssumer = (
40
- stsOptions: Pick<STSClientConfig, "logger" | "region" | "requestHandler">,
41
- stsClientCtor: new (options: STSClientConfig) => STSClient
42
- ): RoleAssumer => {
43
- let stsClient: STSClient;
44
- let closureSourceCreds: Credentials;
45
- return async (sourceCreds, params) => {
46
- closureSourceCreds = sourceCreds;
47
- if (!stsClient) {
48
- const { logger, region, requestHandler } = stsOptions;
49
- stsClient = new stsClientCtor({
50
- logger,
51
- // A hack to make sts client uses the credential in current closure.
52
- credentialDefaultProvider: () => async () => closureSourceCreds,
53
- region: decorateDefaultRegion(region || stsOptions.region),
54
- ...(requestHandler ? { requestHandler } : {}),
55
- });
56
- }
57
- const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
58
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
59
- throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
60
- }
61
- return {
62
- accessKeyId: Credentials.AccessKeyId,
63
- secretAccessKey: Credentials.SecretAccessKey,
64
- sessionToken: Credentials.SessionToken,
65
- expiration: Credentials.Expiration,
66
- };
67
- };
68
- };
69
-
70
- /**
71
- * @internal
72
- */
73
- export type RoleAssumerWithWebIdentity = (params: AssumeRoleWithWebIdentityCommandInput) => Promise<Credentials>;
74
-
75
- /**
76
- * The default role assumer that used by credential providers when sts:AssumeRoleWithWebIdentity API is needed.
77
- * @internal
78
- */
79
- export const getDefaultRoleAssumerWithWebIdentity = (
80
- stsOptions: Pick<STSClientConfig, "logger" | "region" | "requestHandler">,
81
- stsClientCtor: new (options: STSClientConfig) => STSClient
82
- ): RoleAssumerWithWebIdentity => {
83
- let stsClient: STSClient;
84
- return async (params) => {
85
- if (!stsClient) {
86
- const { logger, region, requestHandler } = stsOptions;
87
- stsClient = new stsClientCtor({
88
- logger,
89
- region: decorateDefaultRegion(region || stsOptions.region),
90
- ...(requestHandler ? { requestHandler } : {}),
91
- });
92
- }
93
- const { Credentials } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
94
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
95
- throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`);
96
- }
97
- return {
98
- accessKeyId: Credentials.AccessKeyId,
99
- secretAccessKey: Credentials.SecretAccessKey,
100
- sessionToken: Credentials.SessionToken,
101
- expiration: Credentials.Expiration,
102
- };
103
- };
104
- };
105
-
106
- /**
107
- * @internal
108
- */
109
- export type DefaultCredentialProvider = (input: any) => Provider<Credentials>;
110
-
111
- /**
112
- * The default credential providers depend STS client to assume role with desired API: sts:assumeRole,
113
- * sts:assumeRoleWithWebIdentity, etc. This function decorates the default credential provider with role assumers which
114
- * encapsulates the process of calling STS commands. This can only be imported by AWS client packages to avoid circular
115
- * dependencies.
116
- *
117
- * @internal
118
- */
119
- export const decorateDefaultCredentialProvider =
120
- (provider: DefaultCredentialProvider): DefaultCredentialProvider =>
121
- (input: STSClientResolvedConfig) =>
122
- provider({
123
- roleAssumer: getDefaultRoleAssumer(input, input.stsClientCtor),
124
- roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input, input.stsClientCtor),
125
- ...input,
126
- });
package/src/endpoints.ts DELETED
@@ -1,91 +0,0 @@
1
- import { getRegionInfo, PartitionHash, RegionHash } from "@aws-sdk/config-resolver";
2
- import { RegionInfoProvider } from "@aws-sdk/types";
3
-
4
- const regionHash: RegionHash = {
5
- "aws-global": {
6
- hostname: "sts.amazonaws.com",
7
- signingRegion: "us-east-1",
8
- },
9
- "us-east-1-fips": {
10
- hostname: "sts-fips.us-east-1.amazonaws.com",
11
- signingRegion: "us-east-1",
12
- },
13
- "us-east-2-fips": {
14
- hostname: "sts-fips.us-east-2.amazonaws.com",
15
- signingRegion: "us-east-2",
16
- },
17
- "us-gov-east-1-fips": {
18
- hostname: "sts.us-gov-east-1.amazonaws.com",
19
- signingRegion: "us-gov-east-1",
20
- },
21
- "us-gov-west-1-fips": {
22
- hostname: "sts.us-gov-west-1.amazonaws.com",
23
- signingRegion: "us-gov-west-1",
24
- },
25
- "us-west-1-fips": {
26
- hostname: "sts-fips.us-west-1.amazonaws.com",
27
- signingRegion: "us-west-1",
28
- },
29
- "us-west-2-fips": {
30
- hostname: "sts-fips.us-west-2.amazonaws.com",
31
- signingRegion: "us-west-2",
32
- },
33
- };
34
-
35
- const partitionHash: PartitionHash = {
36
- aws: {
37
- regions: [
38
- "af-south-1",
39
- "ap-east-1",
40
- "ap-northeast-1",
41
- "ap-northeast-2",
42
- "ap-northeast-3",
43
- "ap-south-1",
44
- "ap-southeast-1",
45
- "ap-southeast-2",
46
- "aws-global",
47
- "ca-central-1",
48
- "eu-central-1",
49
- "eu-north-1",
50
- "eu-south-1",
51
- "eu-west-1",
52
- "eu-west-2",
53
- "eu-west-3",
54
- "me-south-1",
55
- "sa-east-1",
56
- "us-east-1",
57
- "us-east-1-fips",
58
- "us-east-2",
59
- "us-east-2-fips",
60
- "us-west-1",
61
- "us-west-1-fips",
62
- "us-west-2",
63
- "us-west-2-fips",
64
- ],
65
- hostname: "sts.{region}.amazonaws.com",
66
- },
67
- "aws-cn": {
68
- regions: ["cn-north-1", "cn-northwest-1"],
69
- hostname: "sts.{region}.amazonaws.com.cn",
70
- },
71
- "aws-iso": {
72
- regions: ["us-iso-east-1"],
73
- hostname: "sts.{region}.c2s.ic.gov",
74
- },
75
- "aws-iso-b": {
76
- regions: ["us-isob-east-1"],
77
- hostname: "sts.{region}.sc2s.sgov.gov",
78
- },
79
- "aws-us-gov": {
80
- regions: ["us-gov-east-1", "us-gov-east-1-fips", "us-gov-west-1", "us-gov-west-1-fips"],
81
- hostname: "sts.{region}.amazonaws.com",
82
- },
83
- };
84
-
85
- export const defaultRegionInfoProvider: RegionInfoProvider = async (region: string, options?: any) =>
86
- getRegionInfo(region, {
87
- ...options,
88
- signingService: "sts",
89
- regionHash,
90
- partitionHash,
91
- });
package/src/index.ts DELETED
@@ -1,12 +0,0 @@
1
- export * from "./STSClient";
2
- export * from "./STS";
3
- export * from "./commands/AssumeRoleCommand";
4
- export * from "./commands/AssumeRoleWithSAMLCommand";
5
- export * from "./commands/AssumeRoleWithWebIdentityCommand";
6
- export * from "./commands/DecodeAuthorizationMessageCommand";
7
- export * from "./commands/GetAccessKeyInfoCommand";
8
- export * from "./commands/GetCallerIdentityCommand";
9
- export * from "./commands/GetFederationTokenCommand";
10
- export * from "./commands/GetSessionTokenCommand";
11
- export * from "./defaultRoleAssumers";
12
- export * from "./models/index";
@@ -1 +0,0 @@
1
- export * from "./models_0";