public class ClasspathJsonFileCredentialsProvider extends Object implements AWSCredentialsProvider
AWSCredentialsProvider
implementation that loads AWS security
credentials from a json file on the classpath. The default
constructor creates a credentials provider that loads the credentials
from a file named cos_credentials
on the
classpath, but which file to use from the classpath can also be controlled
through the one-argument constructor.
The IBM API key is expected to be in the apiKey
property and the IBM resource instance id is expected to be in the
resource_instance_id
property.
Constructor and Description |
---|
ClasspathJsonFileCredentialsProvider()
Creates a new ClasspathJsonFileCredentialsProvider that will
attempt to load the
cos_credentials file from
the classpath to read IBM security credentials. |
ClasspathJsonFileCredentialsProvider(String credentialsFilePath)
Creates a new ClasspathJsonFileCredentialsProvider that will
attempt to load a custom file from the classpath to read IBM security
credentials.
|
Modifier and Type | Method and Description |
---|---|
AWSCredentials |
getCredentials()
Returns AWSCredentials which the caller can use to authorize an AWS request.
|
void |
refresh()
Forces this credentials provider to refresh its credentials.
|
String |
toString() |
public ClasspathJsonFileCredentialsProvider()
cos_credentials
file from
the classpath to read IBM security credentials.public ClasspathJsonFileCredentialsProvider(String credentialsFilePath)
credentialsFilePath
- The custom classpath resource path to a json file
from which the IBM security credentials should be loaded.
For example,
public AWSCredentials getCredentials()
AWSCredentialsProvider
getCredentials
in interface AWSCredentialsProvider
public void refresh()
AWSCredentialsProvider
refresh
in interface AWSCredentialsProvider
Copyright © 2024. All rights reserved.