Class AwsSessionCredentials
- java.lang.Object
-
- software.amazon.awssdk.auth.credentials.AwsSessionCredentials
-
- All Implemented Interfaces:
AwsCredentials,AwsCredentialsIdentity,AwsSessionCredentialsIdentity,Identity,ToCopyableBuilder<AwsSessionCredentials.Builder,AwsSessionCredentials>
@Immutable @SdkPublicApi public final class AwsSessionCredentials extends Object implements AwsCredentials, AwsSessionCredentialsIdentity, ToCopyableBuilder<AwsSessionCredentials.Builder,AwsSessionCredentials>
A special type ofAwsCredentialsthat 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 classAwsSessionCredentials.BuilderA builder for creating an instance ofAwsSessionCredentials.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaccessKeyId()Retrieve the AWS access key, used to identify the user interacting with AWS.Optional<String>accountId()static AwsSessionCredentials.Builderbuilder()Returns a builder for this object.AwsSessionCredentialscopy(Consumer<? super AwsSessionCredentials.Builder> modifier)static AwsSessionCredentialscreate(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.booleanequals(Object o)Optional<Instant>expirationTime()Retrieve the expiration time of these credentials, if it exists.inthashCode()Optional<String>providerName()The name of the identity provider that created this credential identity.StringsecretAccessKey()Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.StringsessionToken()Retrieve the AWS session token.AwsSessionCredentials.BuildertoBuilder()StringtoString()
-
-
-
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:
accessKeyIdin interfaceAwsCredentialsIdentity
-
secretAccessKey
public String secretAccessKey()
Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.- Specified by:
secretAccessKeyin interfaceAwsCredentialsIdentity
-
expirationTime
public Optional<Instant> expirationTime()
Retrieve the expiration time of these credentials, if it exists.- Specified by:
expirationTimein 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:
sessionTokenin interfaceAwsSessionCredentialsIdentity
-
providerName
public Optional<String> providerName()
The name of the identity provider that created this credential identity.- Specified by:
providerNamein interfaceIdentity
-
accountId
public Optional<String> accountId()
- Specified by:
accountIdin interfaceAwsCredentialsIdentity
-
toBuilder
public AwsSessionCredentials.Builder toBuilder()
- Specified by:
toBuilderin interfaceToCopyableBuilder<AwsSessionCredentials.Builder,AwsSessionCredentials>
-
copy
public AwsSessionCredentials copy(Consumer<? super AwsSessionCredentials.Builder> modifier)
- Specified by:
copyin interfaceToCopyableBuilder<AwsSessionCredentials.Builder,AwsSessionCredentials>
-
-