Skip to main content

aws_sdk_sts/client/
get_web_identity_token.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`GetWebIdentityToken`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`audience(impl Into<String>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::audience) / [`set_audience(Option<Vec::<String>>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_audience):<br>required: **true**<br><p>The intended recipient of the web identity token. This value populates the <code>aud</code> claim in the JWT and should identify the service or application that will validate and use the token. The external service should verify this claim to ensure the token was intended for their use.</p><br>
7    ///   - [`duration_seconds(i32)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::duration_seconds) / [`set_duration_seconds(Option<i32>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_duration_seconds):<br>required: **false**<br><p>The duration, in seconds, for which the JSON Web Token (JWT) will remain valid. The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not specified, the default duration is 300 seconds (5 minutes). The token is designed to be short-lived and should be used for proof of identity, then exchanged for credentials or short-lived tokens in the external service.</p><br>
8    ///   - [`signing_algorithm(impl Into<String>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::signing_algorithm) / [`set_signing_algorithm(Option<String>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_signing_algorithm):<br>required: **true**<br><p>The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with SHA-384).</p><br>
9    ///   - [`scope(impl Into<String>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::scope) / [`set_scope(Option<String>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_scope):<br>required: **false**<br><p>One or more OAuth 2.0 scope values to include in the JSON Web Token (JWT). Amazon Web Services STS copies the value exactly as you send it into the top-level <code>scope</code> claim of the token. If you don't specify <code>Scope</code>, the token doesn't include a <code>scope</code> claim.</p> <p>Separate multiple values with a single space, as defined in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-3.3">RFC 6749, section 3.3</a> on the IETF website. Don't begin or end <code>Scope</code> with a space. Each scope value can contain printable ASCII characters except spaces, double quotation marks (<code>"</code>), commas (<code>,</code>), and backslashes (<code>\</code>).</p> <p>You can't repeat a scope value. Scope values are case sensitive. This means that <code>read</code> and <code>READ</code> are separate values.</p> <p>You can specify <code>Scope</code> only when <code>SubjectMode</code> is <code>OriginIdentity</code> and you request exactly one audience. To specify <code>Scope</code>, the calling principal must have permission for the <code>sts:SetWebIdentityTokenScope</code> action in addition to <code>sts:GetWebIdentityToken</code>. You can use the multivalued <code>sts:IdentityTokenScope</code> condition key in a policy to control which scope values a principal can request.</p><br>
10    ///   - [`subject_mode(WebIdentityTokenSubjectModeType)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::subject_mode) / [`set_subject_mode(Option<WebIdentityTokenSubjectModeType>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_subject_mode):<br>required: **false**<br><p>Specifies which identity STS puts in the <code>sub</code> (subject) claim of the JSON Web Token (JWT). Valid values are <code>AWSIdentity</code> and <code>OriginIdentity</code>. If you don't specify a value, Amazon Web Services STS uses <code>AWSIdentity</code>.</p> <ul>  <li>   <p><code>AWSIdentity</code> – The <code>sub</code> claim contains the ARN of the calling Amazon Web Services principal.</p></li>  <li>   <p><code>OriginIdentity</code> – The <code>sub</code> claim contains the value of the <code>aws:OriginIdentity/Subject</code> key in the trusted identity propagation context of the calling session. For example, this can identify the human user or workload on whose behalf the calling session acts. Amazon Web Services STS also adds a <code>subject_mode</code> claim to the token.</p>   <p>To use <code>OriginIdentity</code>, the trusted identity propagation context of the calling session must contain the <code>aws:OriginIdentity/Subject</code> key and either the <code>aws:OriginIdentity/Issuer</code> key or the <code>aws:OriginIdentity/FederatedProviderArn</code> key. If it doesn't, or if the subject is blank, Amazon Web Services STS rejects the request with a validation error.</p>   <p>Amazon Web Services STS denies the request if the subject begins with the text <code>arn:</code>, in any combination of uppercase and lowercase letters. Amazon Web Services STS also denies the request if the subject begins or ends with a space, or contains a control, format, or separator character other than a space.</p></li> </ul> <p>You can use the <code>sts:SubjectMode</code> condition key in a policy to control which subject modes a principal can request.</p><br>
11    ///   - [`tags(Tag)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::tags) / [`set_tags(Option<Vec::<Tag>>)`](crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::set_tags):<br>required: **false**<br><p>An optional list of tags to include in the JSON Web Token (JWT). These tags are added as custom claims to the JWT and can be used by the downstream service for authorization decisions.</p><br>
12    /// - On success, responds with [`GetWebIdentityTokenOutput`](crate::operation::get_web_identity_token::GetWebIdentityTokenOutput) with field(s):
13    ///   - [`web_identity_token(Option<String>)`](crate::operation::get_web_identity_token::GetWebIdentityTokenOutput::web_identity_token): <p>A signed JSON Web Token (JWT) that represents the caller's Amazon Web Services identity or, if you set <code>SubjectMode</code> to <code>OriginIdentity</code>, the human user or workload on whose behalf the calling session acts. The token contains standard JWT claims such as subject, audience, expiration time, and additional identity attributes added by STS as custom claims. These can include the <code>principal_id</code> claim, which contains the ARN of the principal that requested the token, whichever subject mode you use. You can also add your own custom claims to the token by passing tags as request parameters to the <code>GetWebIdentityToken</code> API. The token is signed using the specified signing algorithm and can be verified using the verification keys available at the issuer's JWKS endpoint.</p>
14    ///   - [`expiration(Option<DateTime>)`](crate::operation::get_web_identity_token::GetWebIdentityTokenOutput::expiration): <p>The date and time when the web identity token expires, in UTC. The expiration is determined by adding the <code>DurationSeconds</code> value to the time the token was issued. After this time, the token should no longer be considered valid.</p>
15    /// - On failure, responds with [`SdkError<GetWebIdentityTokenError>`](crate::operation::get_web_identity_token::GetWebIdentityTokenError)
16    pub fn get_web_identity_token(&self) -> crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder {
17        crate::operation::get_web_identity_token::builders::GetWebIdentityTokenFluentBuilder::new(self.handle.clone())
18    }
19}