Class AwsSessionCredentials

java.lang.Object
software.amazon.awssdk.auth.credentials.AwsSessionCredentials
All Implemented Interfaces:
AwsCredentials, AwsCredentialsIdentity, AwsSessionCredentialsIdentity, Identity

@Immutable public final class AwsSessionCredentials extends Object implements AwsCredentials, AwsSessionCredentialsIdentity
A special type of AwsCredentials that provides a session token to be used in service authentication. Session tokens are typically provided by a token broker service, like AWS Security Token Service, and provide temporary access to an AWS service.
  • Method Details

    • builder

      public static AwsSessionCredentials.Builder builder()
      Returns a builder for this object.
    • create

      public static AwsSessionCredentials create(String accessKey, String secretKey, String sessionToken)
      Constructs a new session credentials object, with the specified AWS access key, AWS secret key and AWS session token.
      Parameters:
      accessKey - The AWS access key, used to identify the user interacting with AWS.
      secretKey - The AWS secret access key, used to authenticate the user interacting with AWS.
      sessionToken - The AWS session token, retrieved from an AWS token service, used for authenticating that this user has received temporary permission to access some resource.
    • accessKeyId

      public String accessKeyId()
      Retrieve the AWS access key, used to identify the user interacting with AWS.
      Specified by:
      accessKeyId in interface AwsCredentialsIdentity
    • secretAccessKey

      public String secretAccessKey()
      Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.
      Specified by:
      secretAccessKey in interface AwsCredentialsIdentity
    • expirationTime

      public Optional<Instant> expirationTime()
      Retrieve the expiration time of these credentials, if it exists.
      Specified by:
      expirationTime in interface Identity
    • sessionToken

      public String sessionToken()
      Retrieve the AWS session token. This token is retrieved from an AWS token service, and is used for authenticating that this user has received temporary permission to access some resource.
      Specified by:
      sessionToken in interface AwsSessionCredentialsIdentity
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object