com.ionoscloud.s3.credentials.AwsEnvironmentProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ionos-cloud-sdk-s3 Show documentation
Show all versions of ionos-cloud-sdk-s3 Show documentation
IONOS Java SDK for Amazon S3 Compatible Cloud Storage
The newest version!
package com.ionoscloud.s3.credentials;
/** Credential provider using Amazon AWS specific environment variables. */
public class AwsEnvironmentProvider extends EnvironmentProvider {
public AwsEnvironmentProvider() {}
private final String getAccessKey() {
String value = getProperty("AWS_ACCESS_KEY_ID");
return (value != null) ? value : getProperty("AWS_ACCESS_KEY");
}
private final String getSecretKey() {
String value = getProperty("AWS_SECRET_ACCESS_KEY");
return (value != null) ? value : getProperty("AWS_SECRET_KEY");
}
@Override
public Credentials fetch() {
return new Credentials(getAccessKey(), getSecretKey(), getProperty("AWS_SESSION_TOKEN"), null);
}
}