@aws-sdk/client-sts 3.33.0 → 3.36.1

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 (189) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/{dist/cjs → dist-cjs}/STS.js +1 -9
  3. package/dist-cjs/STSClient.js +34 -0
  4. package/dist-cjs/commands/AssumeRoleCommand.js +38 -0
  5. package/dist-cjs/commands/AssumeRoleWithSAMLCommand.js +36 -0
  6. package/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js +36 -0
  7. package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js +38 -0
  8. package/dist-cjs/commands/GetAccessKeyInfoCommand.js +38 -0
  9. package/dist-cjs/commands/GetCallerIdentityCommand.js +38 -0
  10. package/dist-cjs/commands/GetFederationTokenCommand.js +38 -0
  11. package/dist-cjs/commands/GetSessionTokenCommand.js +38 -0
  12. package/{dist/cjs → dist-cjs}/defaultRoleAssumers.js +0 -17
  13. package/{dist/cjs → dist-cjs}/defaultStsRoleAssumers.js +0 -21
  14. package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
  15. package/{dist/cjs → dist-cjs}/index.js +0 -1
  16. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  17. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -88
  18. package/{dist/cjs → dist-cjs}/protocols/Aws_query.js +22 -25
  19. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
  20. package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
  21. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
  22. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
  23. package/{dist/es → dist-es}/STS.js +2 -10
  24. package/{dist/es → dist-es}/STSClient.js +2 -15
  25. package/dist-es/commands/AssumeRoleCommand.js +41 -0
  26. package/dist-es/commands/AssumeRoleWithSAMLCommand.js +39 -0
  27. package/dist-es/commands/AssumeRoleWithWebIdentityCommand.js +39 -0
  28. package/dist-es/commands/DecodeAuthorizationMessageCommand.js +41 -0
  29. package/dist-es/commands/GetAccessKeyInfoCommand.js +41 -0
  30. package/{dist/es → dist-es}/commands/GetCallerIdentityCommand.js +4 -39
  31. package/dist-es/commands/GetFederationTokenCommand.js +41 -0
  32. package/dist-es/commands/GetSessionTokenCommand.js +41 -0
  33. package/dist-es/defaultRoleAssumers.js +16 -0
  34. package/{dist/es → dist-es}/defaultStsRoleAssumers.js +10 -32
  35. package/{dist/es → dist-es}/endpoints.js +1 -2
  36. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  37. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  38. package/{dist/es → dist-es}/models/models_0.js +0 -88
  39. package/{dist/es → dist-es}/protocols/Aws_query.js +152 -155
  40. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
  41. package/{dist/es → dist-es}/runtimeConfig.js +1 -5
  42. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
  43. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
  44. package/{dist/types → dist-types}/STS.d.ts +2 -2
  45. package/{dist/types → dist-types}/STSClient.d.ts +8 -8
  46. package/{dist/types → dist-types}/commands/AssumeRoleCommand.d.ts +3 -3
  47. package/{dist/types → dist-types}/commands/AssumeRoleWithSAMLCommand.d.ts +3 -3
  48. package/{dist/types → dist-types}/commands/AssumeRoleWithWebIdentityCommand.d.ts +3 -3
  49. package/{dist/types → dist-types}/commands/DecodeAuthorizationMessageCommand.d.ts +3 -3
  50. package/{dist/types → dist-types}/commands/GetAccessKeyInfoCommand.d.ts +3 -3
  51. package/{dist/types → dist-types}/commands/GetCallerIdentityCommand.d.ts +3 -3
  52. package/{dist/types → dist-types}/commands/GetFederationTokenCommand.d.ts +3 -3
  53. package/{dist/types → dist-types}/commands/GetSessionTokenCommand.d.ts +3 -3
  54. package/{dist/types → dist-types}/defaultRoleAssumers.d.ts +0 -0
  55. package/{dist/types → dist-types}/defaultStsRoleAssumers.d.ts +0 -0
  56. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  57. package/{index.ts → dist-types/index.d.ts} +0 -0
  58. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  59. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  60. package/{dist/types → dist-types}/protocols/Aws_query.d.ts +2 -2
  61. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  62. package/{dist/types → dist-types}/runtimeConfig.d.ts +0 -0
  63. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  64. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  65. package/dist-types/ts3.4/STS.d.ts +45 -0
  66. package/{dist/types → dist-types}/ts3.4/STSClient.d.ts +32 -101
  67. package/dist-types/ts3.4/commands/AssumeRoleCommand.d.ts +17 -0
  68. package/dist-types/ts3.4/commands/AssumeRoleWithSAMLCommand.d.ts +17 -0
  69. package/dist-types/ts3.4/commands/AssumeRoleWithWebIdentityCommand.d.ts +17 -0
  70. package/dist-types/ts3.4/commands/DecodeAuthorizationMessageCommand.d.ts +17 -0
  71. package/dist-types/ts3.4/commands/GetAccessKeyInfoCommand.d.ts +17 -0
  72. package/dist-types/ts3.4/commands/GetCallerIdentityCommand.d.ts +17 -0
  73. package/dist-types/ts3.4/commands/GetFederationTokenCommand.d.ts +17 -0
  74. package/dist-types/ts3.4/commands/GetSessionTokenCommand.d.ts +17 -0
  75. package/dist-types/ts3.4/defaultRoleAssumers.d.ts +8 -0
  76. package/{dist/types → dist-types}/ts3.4/defaultStsRoleAssumers.d.ts +6 -25
  77. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  78. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  79. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  80. package/dist-types/ts3.4/models/models_0.d.ts +367 -0
  81. package/{dist/types → dist-types}/ts3.4/protocols/Aws_query.d.ts +2 -2
  82. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
  83. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +1 -3
  84. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
  85. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
  86. package/package.json +52 -49
  87. package/STS.ts +0 -896
  88. package/STSClient.ts +0 -263
  89. package/commands/AssumeRoleCommand.ts +0 -176
  90. package/commands/AssumeRoleWithSAMLCommand.ts +0 -225
  91. package/commands/AssumeRoleWithWebIdentityCommand.ts +0 -232
  92. package/commands/DecodeAuthorizationMessageCommand.ts +0 -134
  93. package/commands/GetAccessKeyInfoCommand.ts +0 -113
  94. package/commands/GetCallerIdentityCommand.ts +0 -105
  95. package/commands/GetFederationTokenCommand.ts +0 -234
  96. package/commands/GetSessionTokenCommand.ts +0 -147
  97. package/defaultRoleAssumers.spec.ts +0 -148
  98. package/defaultRoleAssumers.ts +0 -41
  99. package/defaultStsRoleAssumers.ts +0 -126
  100. package/dist/cjs/STS.js.map +0 -1
  101. package/dist/cjs/STSClient.js +0 -47
  102. package/dist/cjs/STSClient.js.map +0 -1
  103. package/dist/cjs/commands/AssumeRoleCommand.js +0 -146
  104. package/dist/cjs/commands/AssumeRoleCommand.js.map +0 -1
  105. package/dist/cjs/commands/AssumeRoleWithSAMLCommand.js +0 -192
  106. package/dist/cjs/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
  107. package/dist/cjs/commands/AssumeRoleWithWebIdentityCommand.js +0 -196
  108. package/dist/cjs/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
  109. package/dist/cjs/commands/DecodeAuthorizationMessageCommand.js +0 -98
  110. package/dist/cjs/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
  111. package/dist/cjs/commands/GetAccessKeyInfoCommand.js +0 -80
  112. package/dist/cjs/commands/GetAccessKeyInfoCommand.js.map +0 -1
  113. package/dist/cjs/commands/GetCallerIdentityCommand.js +0 -72
  114. package/dist/cjs/commands/GetCallerIdentityCommand.js.map +0 -1
  115. package/dist/cjs/commands/GetFederationTokenCommand.js +0 -201
  116. package/dist/cjs/commands/GetFederationTokenCommand.js.map +0 -1
  117. package/dist/cjs/commands/GetSessionTokenCommand.js +0 -114
  118. package/dist/cjs/commands/GetSessionTokenCommand.js.map +0 -1
  119. package/dist/cjs/defaultRoleAssumers.js.map +0 -1
  120. package/dist/cjs/defaultRoleAssumers.spec.js +0 -135
  121. package/dist/cjs/defaultRoleAssumers.spec.js.map +0 -1
  122. package/dist/cjs/defaultStsRoleAssumers.js.map +0 -1
  123. package/dist/cjs/endpoints.js.map +0 -1
  124. package/dist/cjs/index.js.map +0 -1
  125. package/dist/cjs/models/index.js.map +0 -1
  126. package/dist/cjs/models/models_0.js.map +0 -1
  127. package/dist/cjs/package.json +0 -93
  128. package/dist/cjs/protocols/Aws_query.js.map +0 -1
  129. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  130. package/dist/cjs/runtimeConfig.js.map +0 -1
  131. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  132. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  133. package/dist/es/STS.js.map +0 -1
  134. package/dist/es/STSClient.js.map +0 -1
  135. package/dist/es/commands/AssumeRoleCommand.js +0 -150
  136. package/dist/es/commands/AssumeRoleCommand.js.map +0 -1
  137. package/dist/es/commands/AssumeRoleWithSAMLCommand.js +0 -196
  138. package/dist/es/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
  139. package/dist/es/commands/AssumeRoleWithWebIdentityCommand.js +0 -200
  140. package/dist/es/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
  141. package/dist/es/commands/DecodeAuthorizationMessageCommand.js +0 -102
  142. package/dist/es/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
  143. package/dist/es/commands/GetAccessKeyInfoCommand.js +0 -84
  144. package/dist/es/commands/GetAccessKeyInfoCommand.js.map +0 -1
  145. package/dist/es/commands/GetCallerIdentityCommand.js.map +0 -1
  146. package/dist/es/commands/GetFederationTokenCommand.js +0 -205
  147. package/dist/es/commands/GetFederationTokenCommand.js.map +0 -1
  148. package/dist/es/commands/GetSessionTokenCommand.js +0 -118
  149. package/dist/es/commands/GetSessionTokenCommand.js.map +0 -1
  150. package/dist/es/defaultRoleAssumers.js +0 -33
  151. package/dist/es/defaultRoleAssumers.js.map +0 -1
  152. package/dist/es/defaultRoleAssumers.spec.js +0 -142
  153. package/dist/es/defaultRoleAssumers.spec.js.map +0 -1
  154. package/dist/es/defaultStsRoleAssumers.js.map +0 -1
  155. package/dist/es/endpoints.js.map +0 -1
  156. package/dist/es/index.js +0 -13
  157. package/dist/es/index.js.map +0 -1
  158. package/dist/es/models/index.js +0 -2
  159. package/dist/es/models/index.js.map +0 -1
  160. package/dist/es/models/models_0.js.map +0 -1
  161. package/dist/es/package.json +0 -93
  162. package/dist/es/protocols/Aws_query.js.map +0 -1
  163. package/dist/es/runtimeConfig.browser.js.map +0 -1
  164. package/dist/es/runtimeConfig.js.map +0 -1
  165. package/dist/es/runtimeConfig.native.js.map +0 -1
  166. package/dist/es/runtimeConfig.shared.js.map +0 -1
  167. package/dist/types/defaultRoleAssumers.spec.d.ts +0 -1
  168. package/dist/types/ts3.4/STS.d.ts +0 -666
  169. package/dist/types/ts3.4/commands/AssumeRoleCommand.d.ts +0 -118
  170. package/dist/types/ts3.4/commands/AssumeRoleWithSAMLCommand.d.ts +0 -166
  171. package/dist/types/ts3.4/commands/AssumeRoleWithWebIdentityCommand.d.ts +0 -170
  172. package/dist/types/ts3.4/commands/DecodeAuthorizationMessageCommand.d.ts +0 -70
  173. package/dist/types/ts3.4/commands/GetAccessKeyInfoCommand.d.ts +0 -52
  174. package/dist/types/ts3.4/commands/GetCallerIdentityCommand.d.ts +0 -44
  175. package/dist/types/ts3.4/commands/GetFederationTokenCommand.d.ts +0 -173
  176. package/dist/types/ts3.4/commands/GetSessionTokenCommand.d.ts +0 -86
  177. package/dist/types/ts3.4/defaultRoleAssumers.d.ts +0 -19
  178. package/dist/types/ts3.4/defaultRoleAssumers.spec.d.ts +0 -1
  179. package/dist/types/ts3.4/models/models_0.d.ts +0 -1192
  180. package/endpoints.ts +0 -91
  181. package/jest.config.js +0 -4
  182. package/models/models_0.ts +0 -1361
  183. package/protocols/Aws_query.ts +0 -1513
  184. package/runtimeConfig.browser.ts +0 -40
  185. package/runtimeConfig.native.ts +0 -16
  186. package/runtimeConfig.shared.ts +0 -16
  187. package/runtimeConfig.ts +0 -45
  188. package/tsconfig.es.json +0 -12
  189. package/tsconfig.json +0 -32
@@ -1,234 +0,0 @@
1
- import { STSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../STSClient";
2
- import { GetFederationTokenRequest, GetFederationTokenResponse } from "../models/models_0";
3
- import {
4
- deserializeAws_queryGetFederationTokenCommand,
5
- serializeAws_queryGetFederationTokenCommand,
6
- } from "../protocols/Aws_query";
7
- import { getSerdePlugin } from "@aws-sdk/middleware-serde";
8
- import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
9
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
10
- import { Command as $Command } from "@aws-sdk/smithy-client";
11
- import {
12
- FinalizeHandlerArguments,
13
- Handler,
14
- HandlerExecutionContext,
15
- MiddlewareStack,
16
- HttpHandlerOptions as __HttpHandlerOptions,
17
- MetadataBearer as __MetadataBearer,
18
- SerdeContext as __SerdeContext,
19
- } from "@aws-sdk/types";
20
-
21
- export interface GetFederationTokenCommandInput extends GetFederationTokenRequest {}
22
- export interface GetFederationTokenCommandOutput extends GetFederationTokenResponse, __MetadataBearer {}
23
-
24
- /**
25
- * <p>Returns a set of temporary security credentials (consisting of an access key ID, a
26
- * secret access key, and a security token) for a federated user. A typical use is in a proxy
27
- * application that gets temporary security credentials on behalf of distributed applications
28
- * inside a corporate network. You must call the <code>GetFederationToken</code> operation
29
- * using the long-term security credentials of an IAM user. As a result, this call is
30
- * appropriate in contexts where those credentials can be safely stored, usually in a
31
- * server-based application. For a comparison of <code>GetFederationToken</code> with the
32
- * 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
33
- * Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the
34
- * STS API operations</a> in the <i>IAM User Guide</i>.</p>
35
- * <note>
36
- * <p>You can create a mobile-based or browser-based app that can authenticate users using
37
- * a web identity provider like Login with Amazon, Facebook, Google, or an OpenID
38
- * Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or
39
- * <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
40
- * <i>IAM User Guide</i>.</p>
41
- * </note>
42
- * <p>You can also call <code>GetFederationToken</code> using the security credentials of an
43
- * Amazon Web Services account root user, but we do not recommend it. Instead, we recommend that you create
44
- * an IAM user for the purpose of the proxy application. Then attach a policy to the IAM
45
- * user that limits federated users to only the actions and resources that they need to
46
- * access. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html">IAM Best Practices</a> in the
47
- * <i>IAM User Guide</i>. </p>
48
- * <p>
49
- * <b>Session duration</b>
50
- * </p>
51
- * <p>The temporary credentials are valid for the specified duration, from 900 seconds (15
52
- * minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is
53
- * 43,200 seconds (12 hours). Temporary credentials that are obtained by using Amazon Web Services account
54
- * root user credentials have a maximum duration of 3,600 seconds (1 hour).</p>
55
- * <p>
56
- * <b>Permissions</b>
57
- * </p>
58
- * <p>You can use the temporary credentials created by <code>GetFederationToken</code> in any
59
- * Amazon Web Services service except the following:</p>
60
- * <ul>
61
- * <li>
62
- * <p>You cannot call any IAM operations using the CLI or the Amazon Web Services API. </p>
63
- * </li>
64
- * <li>
65
- * <p>You cannot call any STS operations except <code>GetCallerIdentity</code>.</p>
66
- * </li>
67
- * </ul>
68
- * <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
69
- * this operation. You can pass a single JSON policy document to use as an inline session
70
- * policy. You can also specify up to 10 managed policies to use as managed session policies.
71
- * The plaintext that you use for both inline and managed session policies can't exceed 2,048
72
- * characters.</p>
73
- * <p>Though the session policy parameters are optional, if you do not pass a policy, then the
74
- * resulting federated user session has no permissions. When you pass session policies, the
75
- * session permissions are the intersection of the IAM user policies and the session
76
- * policies that you pass. This gives you a way to further restrict the permissions for a
77
- * federated user. You cannot use session policies to grant more permissions than those that
78
- * 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
79
- * Policies</a> in the <i>IAM User Guide</i>. For information about
80
- * 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>
81
- * <p>You can use the credentials to access a resource that has a resource-based policy. If
82
- * that policy specifically references the federated user session in the
83
- * <code>Principal</code> element of the policy, the session has the permissions allowed by
84
- * the policy. These permissions are granted in addition to the permissions granted by the
85
- * session policies.</p>
86
- * <p>
87
- * <b>Tags</b>
88
- * </p>
89
- * <p>(Optional) You can pass tag key-value pairs to your session. These are called session
90
- * 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
91
- * <i>IAM User Guide</i>.</p>
92
- * <note>
93
- * <p>You can create a mobile-based or browser-based app that can authenticate users
94
- * using a web identity provider like Login with Amazon, Facebook, Google, or an OpenID
95
- * Connect-compatible identity provider. In this case, we recommend that you use <a href="http://aws.amazon.com/cognito/">Amazon Cognito</a> or
96
- * <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
97
- * <i>IAM User Guide</i>.</p>
98
- * </note>
99
- * <p>You can also call <code>GetFederationToken</code> using the security credentials of an
100
- * Amazon Web Services account root user, but we do not recommend it. Instead, we recommend that you
101
- * create an IAM user for the purpose of the proxy application. Then attach a policy to
102
- * the IAM user that limits federated users to only the actions and resources that they
103
- * 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
104
- * <i>IAM User Guide</i>. </p>
105
- * <p>
106
- * <b>Session duration</b>
107
- * </p>
108
- * <p>The temporary credentials are valid for the specified duration, from 900 seconds (15
109
- * minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is
110
- * 43,200 seconds (12 hours). Temporary credentials that are obtained by using Amazon Web Services
111
- * account root user credentials have a maximum duration of 3,600 seconds (1 hour).</p>
112
- * <p>
113
- * <b>Permissions</b>
114
- * </p>
115
- * <p>You can use the temporary credentials created by <code>GetFederationToken</code> in
116
- * any Amazon Web Services service except the following:</p>
117
- * <ul>
118
- * <li>
119
- * <p>You cannot call any IAM operations using the CLI or the Amazon Web Services API.
120
- * </p>
121
- * </li>
122
- * <li>
123
- * <p>You cannot call any STS operations except
124
- * <code>GetCallerIdentity</code>.</p>
125
- * </li>
126
- * </ul>
127
- * <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
128
- * this operation. You can pass a single JSON policy document to use as an inline session
129
- * policy. You can also specify up to 10 managed policies to use as managed session
130
- * policies. The plain text that you use for both inline and managed session policies can't
131
- * exceed 2,048 characters.</p>
132
- * <p>Though the session policy parameters are optional, if you do not pass a policy, then
133
- * the resulting federated user session has no permissions. When you pass session policies,
134
- * the session permissions are the intersection of the IAM user policies and the session
135
- * policies that you pass. This gives you a way to further restrict the permissions for a
136
- * federated user. You cannot use session policies to grant more permissions than those
137
- * that are defined in the permissions policy of the IAM user. For more information, see
138
- * <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session">Session Policies</a>
139
- * in the <i>IAM User Guide</i>. For information about using
140
- * <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>
141
- * <p>You can use the credentials to access a resource that has a resource-based policy. If
142
- * that policy specifically references the federated user session in the
143
- * <code>Principal</code> element of the policy, the session has the permissions
144
- * allowed by the policy. These permissions are granted in addition to the permissions
145
- * granted by the session policies.</p>
146
- * <p>
147
- * <b>Tags</b>
148
- * </p>
149
- * <p>(Optional) You can pass tag key-value pairs to your session. These are called session
150
- * 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
151
- * the <i>IAM User Guide</i>.</p>
152
- * <p>An administrator must grant you the permissions necessary to pass session tags. The
153
- * administrator can also create granular permissions to allow you to pass only specific
154
- * session tags. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html">Tutorial: Using
155
- * Tags for Attribute-Based Access Control</a> in the
156
- * <i>IAM User Guide</i>.</p>
157
- * <p>Tag key–value pairs are not case sensitive, but case is preserved. This means that you
158
- * cannot have separate <code>Department</code> and <code>department</code> tag keys.
159
- * Assume that the user that you are federating has the
160
- * <code>Department</code>=<code>Marketing</code> tag and you pass the
161
- * <code>department</code>=<code>engineering</code> session tag.
162
- * <code>Department</code> and <code>department</code> are not saved as separate tags,
163
- * and the session tag passed in the request takes precedence over the user tag.</p>
164
- * @example
165
- * Use a bare-bones client and the command you need to make an API call.
166
- * ```javascript
167
- * import { STSClient, GetFederationTokenCommand } from "@aws-sdk/client-sts"; // ES Modules import
168
- * // const { STSClient, GetFederationTokenCommand } = require("@aws-sdk/client-sts"); // CommonJS import
169
- * const client = new STSClient(config);
170
- * const command = new GetFederationTokenCommand(input);
171
- * const response = await client.send(command);
172
- * ```
173
- *
174
- * @see {@link GetFederationTokenCommandInput} for command's `input` shape.
175
- * @see {@link GetFederationTokenCommandOutput} for command's `response` shape.
176
- * @see {@link STSClientResolvedConfig | config} for command's `input` shape.
177
- *
178
- */
179
- export class GetFederationTokenCommand extends $Command<
180
- GetFederationTokenCommandInput,
181
- GetFederationTokenCommandOutput,
182
- STSClientResolvedConfig
183
- > {
184
- // Start section: command_properties
185
- // End section: command_properties
186
-
187
- constructor(readonly input: GetFederationTokenCommandInput) {
188
- // Start section: command_constructor
189
- super();
190
- // End section: command_constructor
191
- }
192
-
193
- /**
194
- * @internal
195
- */
196
- resolveMiddleware(
197
- clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
198
- configuration: STSClientResolvedConfig,
199
- options?: __HttpHandlerOptions
200
- ): Handler<GetFederationTokenCommandInput, GetFederationTokenCommandOutput> {
201
- this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
202
- this.middlewareStack.use(getAwsAuthPlugin(configuration));
203
-
204
- const stack = clientStack.concat(this.middlewareStack);
205
-
206
- const { logger } = configuration;
207
- const clientName = "STSClient";
208
- const commandName = "GetFederationTokenCommand";
209
- const handlerExecutionContext: HandlerExecutionContext = {
210
- logger,
211
- clientName,
212
- commandName,
213
- inputFilterSensitiveLog: GetFederationTokenRequest.filterSensitiveLog,
214
- outputFilterSensitiveLog: GetFederationTokenResponse.filterSensitiveLog,
215
- };
216
- const { requestHandler } = configuration;
217
- return stack.resolve(
218
- (request: FinalizeHandlerArguments<any>) =>
219
- requestHandler.handle(request.request as __HttpRequest, options || {}),
220
- handlerExecutionContext
221
- );
222
- }
223
-
224
- private serialize(input: GetFederationTokenCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
225
- return serializeAws_queryGetFederationTokenCommand(input, context);
226
- }
227
-
228
- private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetFederationTokenCommandOutput> {
229
- return deserializeAws_queryGetFederationTokenCommand(output, context);
230
- }
231
-
232
- // Start section: command_body_extra
233
- // End section: command_body_extra
234
- }
@@ -1,147 +0,0 @@
1
- import { STSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../STSClient";
2
- import { GetSessionTokenRequest, GetSessionTokenResponse } from "../models/models_0";
3
- import {
4
- deserializeAws_queryGetSessionTokenCommand,
5
- serializeAws_queryGetSessionTokenCommand,
6
- } from "../protocols/Aws_query";
7
- import { getSerdePlugin } from "@aws-sdk/middleware-serde";
8
- import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
9
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
10
- import { Command as $Command } from "@aws-sdk/smithy-client";
11
- import {
12
- FinalizeHandlerArguments,
13
- Handler,
14
- HandlerExecutionContext,
15
- MiddlewareStack,
16
- HttpHandlerOptions as __HttpHandlerOptions,
17
- MetadataBearer as __MetadataBearer,
18
- SerdeContext as __SerdeContext,
19
- } from "@aws-sdk/types";
20
-
21
- export interface GetSessionTokenCommandInput extends GetSessionTokenRequest {}
22
- export interface GetSessionTokenCommandOutput extends GetSessionTokenResponse, __MetadataBearer {}
23
-
24
- /**
25
- * <p>Returns a set of temporary credentials for an Amazon Web Services account or IAM user. The
26
- * credentials consist of an access key ID, a secret access key, and a security token.
27
- * Typically, you use <code>GetSessionToken</code> if you want to use MFA to protect
28
- * programmatic calls to specific Amazon Web Services API operations like Amazon EC2 <code>StopInstances</code>.
29
- * MFA-enabled IAM users would need to call <code>GetSessionToken</code> and submit an MFA
30
- * code that is associated with their MFA device. Using the temporary security credentials
31
- * that are returned from the call, IAM users can then make programmatic calls to API
32
- * operations that require MFA authentication. If you do not supply a correct MFA code, then
33
- * the API returns an access denied error. For a comparison of <code>GetSessionToken</code>
34
- * 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
35
- * Temporary Security Credentials</a> and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison">Comparing the
36
- * STS API operations</a> in the <i>IAM User Guide</i>.</p>
37
- * <p>
38
- * <b>Session Duration</b>
39
- * </p>
40
- * <p>The <code>GetSessionToken</code> operation must be called by using the long-term Amazon Web Services
41
- * security credentials of the Amazon Web Services account root user or an IAM user. Credentials that are
42
- * created by IAM users are valid for the duration that you specify. This duration can range
43
- * from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default
44
- * of 43,200 seconds (12 hours). Credentials based on account credentials can range from 900
45
- * seconds (15 minutes) up to 3,600 seconds (1 hour), with a default of 1 hour. </p>
46
- * <p>
47
- * <b>Permissions</b>
48
- * </p>
49
- * <p>The temporary security credentials created by <code>GetSessionToken</code> can be used
50
- * to make API calls to any Amazon Web Services service with the following exceptions:</p>
51
- * <ul>
52
- * <li>
53
- * <p>You cannot call any IAM API operations unless MFA authentication information is
54
- * included in the request.</p>
55
- * </li>
56
- * <li>
57
- * <p>You cannot call any STS API <i>except</i>
58
- * <code>AssumeRole</code> or <code>GetCallerIdentity</code>.</p>
59
- * </li>
60
- * </ul>
61
- * <note>
62
- * <p>We recommend that you do not call <code>GetSessionToken</code> with Amazon Web Services account
63
- * 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
64
- * creating one or more IAM users, giving them the necessary permissions, and using IAM
65
- * users for everyday interaction with Amazon Web Services. </p>
66
- * </note>
67
- * <p>The credentials that are returned by <code>GetSessionToken</code> are based on
68
- * permissions associated with the user whose credentials were used to call the operation. If
69
- * <code>GetSessionToken</code> is called using Amazon Web Services account root user credentials, the
70
- * temporary credentials have root user permissions. Similarly, if
71
- * <code>GetSessionToken</code> is called using the credentials of an IAM user, the
72
- * temporary credentials have the same permissions as the IAM user. </p>
73
- * <p>For more information about using <code>GetSessionToken</code> to create temporary
74
- * credentials, go to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken">Temporary
75
- * Credentials for Users in Untrusted Environments</a> in the
76
- * <i>IAM User Guide</i>. </p>
77
- * @example
78
- * Use a bare-bones client and the command you need to make an API call.
79
- * ```javascript
80
- * import { STSClient, GetSessionTokenCommand } from "@aws-sdk/client-sts"; // ES Modules import
81
- * // const { STSClient, GetSessionTokenCommand } = require("@aws-sdk/client-sts"); // CommonJS import
82
- * const client = new STSClient(config);
83
- * const command = new GetSessionTokenCommand(input);
84
- * const response = await client.send(command);
85
- * ```
86
- *
87
- * @see {@link GetSessionTokenCommandInput} for command's `input` shape.
88
- * @see {@link GetSessionTokenCommandOutput} for command's `response` shape.
89
- * @see {@link STSClientResolvedConfig | config} for command's `input` shape.
90
- *
91
- */
92
- export class GetSessionTokenCommand extends $Command<
93
- GetSessionTokenCommandInput,
94
- GetSessionTokenCommandOutput,
95
- STSClientResolvedConfig
96
- > {
97
- // Start section: command_properties
98
- // End section: command_properties
99
-
100
- constructor(readonly input: GetSessionTokenCommandInput) {
101
- // Start section: command_constructor
102
- super();
103
- // End section: command_constructor
104
- }
105
-
106
- /**
107
- * @internal
108
- */
109
- resolveMiddleware(
110
- clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
111
- configuration: STSClientResolvedConfig,
112
- options?: __HttpHandlerOptions
113
- ): Handler<GetSessionTokenCommandInput, GetSessionTokenCommandOutput> {
114
- this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
115
- this.middlewareStack.use(getAwsAuthPlugin(configuration));
116
-
117
- const stack = clientStack.concat(this.middlewareStack);
118
-
119
- const { logger } = configuration;
120
- const clientName = "STSClient";
121
- const commandName = "GetSessionTokenCommand";
122
- const handlerExecutionContext: HandlerExecutionContext = {
123
- logger,
124
- clientName,
125
- commandName,
126
- inputFilterSensitiveLog: GetSessionTokenRequest.filterSensitiveLog,
127
- outputFilterSensitiveLog: GetSessionTokenResponse.filterSensitiveLog,
128
- };
129
- const { requestHandler } = configuration;
130
- return stack.resolve(
131
- (request: FinalizeHandlerArguments<any>) =>
132
- requestHandler.handle(request.request as __HttpRequest, options || {}),
133
- handlerExecutionContext
134
- );
135
- }
136
-
137
- private serialize(input: GetSessionTokenCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
138
- return serializeAws_queryGetSessionTokenCommand(input, context);
139
- }
140
-
141
- private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetSessionTokenCommandOutput> {
142
- return deserializeAws_queryGetSessionTokenCommand(output, context);
143
- }
144
-
145
- // Start section: command_body_extra
146
- // End section: command_body_extra
147
- }
@@ -1,148 +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.spec.ts
3
- import { HttpResponse } from "@aws-sdk/protocol-http";
4
- import { Readable } from "stream";
5
-
6
- const mockHandle = jest.fn().mockResolvedValue({
7
- response: new HttpResponse({
8
- statusCode: 200,
9
- body: Readable.from([""]),
10
- }),
11
- });
12
- jest.mock("@aws-sdk/node-http-handler", () => ({
13
- NodeHttpHandler: jest.fn().mockImplementation(() => ({
14
- destroy: () => {},
15
- handle: mockHandle,
16
- })),
17
- streamCollector: jest.fn(),
18
- }));
19
-
20
- import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "./defaultRoleAssumers";
21
- import type { AssumeRoleCommandInput } from "./commands/AssumeRoleCommand";
22
- import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
23
- import { AssumeRoleWithWebIdentityCommandInput } from "./commands/AssumeRoleWithWebIdentityCommand";
24
- const mockConstructorInput = jest.fn();
25
- jest.mock("./STSClient", () => ({
26
- STSClient: function (params: any) {
27
- mockConstructorInput(params);
28
- //@ts-ignore
29
- return new (jest.requireActual("./STSClient").STSClient)(params);
30
- },
31
- }));
32
-
33
- describe("getDefaultRoleAssumer", () => {
34
- const assumeRoleResponse = `<AssumeRoleResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
35
- <AssumeRoleResult>
36
- <AssumedRoleUser>
37
- <AssumedRoleId>AROAZOX2IL27GNRBJHWC2:session</AssumedRoleId>
38
- <Arn>arn:aws:sts::123:assumed-role/assume-role-test/session</Arn>
39
- </AssumedRoleUser>
40
- <Credentials>
41
- <AccessKeyId>key</AccessKeyId>
42
- <SecretAccessKey>secrete</SecretAccessKey>
43
- <SessionToken>session-token</SessionToken>
44
- <Expiration>2021-05-05T23:22:08Z</Expiration>
45
- </Credentials>
46
- </AssumeRoleResult>
47
- <ResponseMetadata>
48
- <RequestId>12345678id</RequestId>
49
- </ResponseMetadata>
50
- </AssumeRoleResponse>`;
51
-
52
- beforeAll(() => {
53
- (streamCollector as jest.Mock).mockImplementation(async () => Buffer.from(assumeRoleResponse));
54
- });
55
-
56
- beforeEach(() => {
57
- jest.clearAllMocks();
58
- });
59
-
60
- it("should use supplied source credentials", async () => {
61
- const roleAssumer = getDefaultRoleAssumer();
62
- const params: AssumeRoleCommandInput = {
63
- RoleArn: "arn:aws:foo",
64
- RoleSessionName: "session",
65
- };
66
- const sourceCred1 = { accessKeyId: "key1", secretAccessKey: "secrete1" };
67
- await roleAssumer(sourceCred1, params);
68
- expect(mockHandle).toBeCalledTimes(1);
69
- // Validate request is signed by sourceCred1
70
- expect(mockHandle.mock.calls[0][0].headers?.authorization).toEqual(
71
- expect.stringContaining("AWS4-HMAC-SHA256 Credential=key1/")
72
- );
73
- const sourceCred2 = { accessKeyId: "key2", secretAccessKey: "secrete1" };
74
- await roleAssumer(sourceCred2, params);
75
- // Validate request is signed by sourceCred2
76
- expect(mockHandle).toBeCalledTimes(2);
77
- expect(mockHandle.mock.calls[1][0].headers?.authorization).toEqual(
78
- expect.stringContaining("AWS4-HMAC-SHA256 Credential=key2/")
79
- );
80
- });
81
-
82
- it("should use the STS client config", async () => {
83
- const logger = console;
84
- const region = "some-region";
85
- const handler = new NodeHttpHandler();
86
- const roleAssumer = getDefaultRoleAssumer({
87
- region,
88
- logger,
89
- requestHandler: handler,
90
- });
91
- const params: AssumeRoleCommandInput = {
92
- RoleArn: "arn:aws:foo",
93
- RoleSessionName: "session",
94
- };
95
- const sourceCred = { accessKeyId: "key", secretAccessKey: "secrete" };
96
- await roleAssumer(sourceCred, params);
97
- expect(mockConstructorInput).toHaveBeenCalledTimes(1);
98
- expect(mockConstructorInput.mock.calls[0][0]).toMatchObject({
99
- logger,
100
- requestHandler: handler,
101
- region,
102
- });
103
- });
104
- });
105
-
106
- describe("getDefaultRoleAssumerWithWebIdentity", () => {
107
- const assumeRoleResponse = `<Response xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
108
- <AssumeRoleWithWebIdentityResult>
109
- <Credentials>
110
- <AccessKeyId>key</AccessKeyId>
111
- <SecretAccessKey>secrete</SecretAccessKey>
112
- <SessionToken>session-token</SessionToken>
113
- <Expiration>2021-05-05T23:22:08Z</Expiration>
114
- </Credentials>
115
- </AssumeRoleWithWebIdentityResult>
116
- </Response>`;
117
-
118
- beforeAll(() => {
119
- (streamCollector as jest.Mock).mockImplementation(async () => Buffer.from(assumeRoleResponse));
120
- });
121
-
122
- beforeEach(() => {
123
- jest.clearAllMocks();
124
- });
125
-
126
- it("should use the STS client config", async () => {
127
- const logger = console;
128
- const region = "some-region";
129
- const handler = new NodeHttpHandler();
130
- const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
131
- region,
132
- logger,
133
- requestHandler: handler,
134
- });
135
- const params: AssumeRoleWithWebIdentityCommandInput = {
136
- RoleArn: "arn:aws:foo",
137
- RoleSessionName: "session",
138
- WebIdentityToken: "token",
139
- };
140
- await roleAssumerWithWebIdentity(params);
141
- expect(mockConstructorInput).toHaveBeenCalledTimes(1);
142
- expect(mockConstructorInput.mock.calls[0][0]).toMatchObject({
143
- logger,
144
- requestHandler: handler,
145
- region,
146
- });
147
- });
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
- });