Class TokenRequest

java.lang.Object
com.eqixiac.equinix.sts.model.json.creators.TokenRequest

public class TokenRequest extends Object
An OAuth 2.0 token-exchange request body (RFC 8693) for POST /v1/token (operationId generateStsToken, spec schema TokenRequest).

Unlike the other request bodies in the SDK, this endpoint consumes application/x-www-form-urlencoded, so this type exposes its fields as a name/value map via toFormFields() rather than being JSON-serialized.

The form field names are the RFC 8693 ones (grant_type, scope, subject_token, subject_token_type). The STS v1 spec's TokenRequest schema lists camelCase names, but the live service answers unsupported_grant_type to grantType and only parses the RFC names (probed 2026-11-11).

  • Constructor Details

    • TokenRequest

      public TokenRequest()
  • Method Details

    • grantType

      public TokenRequest grantType(String grantType)
      Sets the OAuth 2.0 grant type (required), e.g. urn:ietf:params:oauth:grant-type:token-exchange.
      Parameters:
      grantType - the grant type
      Returns:
      this request for chaining
    • scope

      public TokenRequest scope(String scope)
      Sets the requested scope for the access token.

      The service accepts only an access-policy ERN, roleassignments:<org-id>, projectpolicies:<project-id> or principalpolicy:<project-id> (live, 2026-11-11); prefer scope(StsScope).

      Parameters:
      scope - the requested scope
      Returns:
      this request for chaining
    • scope

      public TokenRequest scope(StsScope scope)
      Sets the requested scope from a typed StsScope.
      Parameters:
      scope - the requested scope
      Returns:
      this request for chaining
    • subjectToken

      public TokenRequest subjectToken(String subjectToken)
      Sets the ID token to exchange.
      Parameters:
      subjectToken - the subject token
      Returns:
      this request for chaining
    • subjectTokenType

      public TokenRequest subjectTokenType(String subjectTokenType)
      Sets the subject token type, e.g. urn:ietf:params:oauth:token-type:id_token.
      Parameters:
      subjectTokenType - the subject token type
      Returns:
      this request for chaining
    • toFormFields

      public Map<String,String> toFormFields()
      Renders this request as an ordered map of form field name to value, omitting unset (null) fields. Used to build the application/x-www-form-urlencoded request body.
      Returns:
      the form fields for this token request