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 ofAwsCredentials
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AwsSessionCredentials.Builder
A builder for creating an instance ofAwsSessionCredentials
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
accessKeyId()
Retrieve the AWS access key, used to identify the user interacting with AWS.static AwsSessionCredentials.Builder
builder()
Returns a builder for this object.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.boolean
equals(Object o)
Optional<Instant>
expirationTime()
Retrieve the expiration time of these credentials, if it exists.int
hashCode()
String
secretAccessKey()
Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.String
sessionToken()
Retrieve the AWS session token.String
toString()
-
-
-
Method Detail
-
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 interfaceAwsCredentialsIdentity
-
secretAccessKey
public String secretAccessKey()
Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.- Specified by:
secretAccessKey
in interfaceAwsCredentialsIdentity
-
expirationTime
public Optional<Instant> expirationTime()
Retrieve the expiration time of these credentials, if it exists.- Specified by:
expirationTime
in interfaceIdentity
-
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 interfaceAwsSessionCredentialsIdentity
-
-