Class AwsBasicCredentials
- java.lang.Object
-
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials
-
- All Implemented Interfaces:
AwsCredentials
,AwsCredentialsIdentity
,Identity
,ToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>
@Immutable public final class AwsBasicCredentials extends Object implements AwsCredentials, ToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>
Provides access to the AWS credentials used for accessing services: AWS access key ID and secret access key. These credentials are used to securely sign requests to services (e.g., AWS services) that use them for authentication.For more details on AWS access keys, see: https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys
- See Also:
AwsCredentialsProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AwsBasicCredentials.Builder
A builder for creating an instance ofAwsBasicCredentials
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AwsBasicCredentials(String accessKeyId, String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.
-
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.Optional<String>
accountId()
Retrieve the AWS account id associated with this credentials identity, if found.static AwsBasicCredentials.Builder
builder()
AwsBasicCredentials
copy(Consumer<? super AwsBasicCredentials.Builder> modifier)
static AwsBasicCredentials
create(String accessKeyId, String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.boolean
equals(Object o)
int
hashCode()
Optional<String>
providerName()
The name of the identity provider that created this credential identity.String
secretAccessKey()
Retrieve the AWS secret access key, used to authenticate the user interacting with AWS.AwsBasicCredentials.Builder
toBuilder()
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.identity.spi.Identity
expirationTime
-
-
-
-
Constructor Detail
-
AwsBasicCredentials
protected AwsBasicCredentials(String accessKeyId, String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.- Parameters:
accessKeyId
- The AWS access key, used to identify the user interacting with AWS.secretAccessKey
- The AWS secret access key, used to authenticate the user interacting with AWS.
-
-
Method Detail
-
builder
public static AwsBasicCredentials.Builder builder()
-
create
public static AwsBasicCredentials create(String accessKeyId, String secretAccessKey)
Constructs a new credentials object, with the specified AWS access key and AWS secret key.- Parameters:
accessKeyId
- The AWS access key, used to identify the user interacting with AWS.secretAccessKey
- The AWS secret access key, used to authenticate the user interacting with AWS.
-
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
-
providerName
public Optional<String> providerName()
The name of the identity provider that created this credential identity.- Specified by:
providerName
in interfaceIdentity
-
accountId
public Optional<String> accountId()
Retrieve the AWS account id associated with this credentials identity, if found.- Specified by:
accountId
in interfaceAwsCredentialsIdentity
-
toBuilder
public AwsBasicCredentials.Builder toBuilder()
- Specified by:
toBuilder
in interfaceToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>
-
copy
public AwsBasicCredentials copy(Consumer<? super AwsBasicCredentials.Builder> modifier)
- Specified by:
copy
in interfaceToCopyableBuilder<AwsBasicCredentials.Builder,AwsBasicCredentials>
-
-