public class JsonCredentials extends Object implements IBMOAuthCredentials
Constructor and Description |
---|
JsonCredentials(File file)
Reads the specified file as a Json file and extracts the IBM api key from the
"apikey" field and IBM resource instance id from the "resource#_instance_id"
filed.
|
JsonCredentials(InputStream stream)
Reads the specified input stream as a stream of json object content and
extracts the IBM api key and resource instance id from the object.
|
Modifier and Type | Method and Description |
---|---|
String |
getApiKey()
Returns the IBM API Key for this credentials object.
|
String |
getAWSAccessKeyId()
Returns the AWS access key ID for this credentials object.
|
String |
getAWSSecretKey()
Returns the AWS secret access key for this credentials object.
|
String |
getServiceInstanceId()
Returns the IBM Service Instance Id for this credentials object.
|
TokenManager |
getTokenManager()
Returns the IAM TokenManager.
|
boolean |
isHmacEnabled() |
boolean |
isIamEnabled() |
void |
setTokenManager(TokenManager tokenManager)
allows the token manager to be set outside this class.
|
public JsonCredentials(File file) throws FileNotFoundException, IOException, IllegalArgumentException
file
- The file from which to read the IBM credentials.FileNotFoundException
- If the specified file isn't found.IOException
- If any problems are encountered reading the IBM credentials from
the specified file.IllegalArgumentException
- If the specified json file does not contain the required keys.public JsonCredentials(InputStream stream) throws IOException
inputStream
- The input stream containing the IBM credential properties.IOException
- If any problems occur while reading from the input stream.public String getAWSAccessKeyId()
AWSCredentials
getAWSAccessKeyId
in interface AWSCredentials
public String getAWSSecretKey()
AWSCredentials
getAWSSecretKey
in interface AWSCredentials
public String getApiKey()
IBMOAuthCredentials
getApiKey
in interface IBMOAuthCredentials
public String getServiceInstanceId()
IBMOAuthCredentials
getServiceInstanceId
in interface IBMOAuthCredentials
public TokenManager getTokenManager()
IBMOAuthCredentials
getTokenManager
in interface IBMOAuthCredentials
public boolean isHmacEnabled()
public boolean isIamEnabled()
public void setTokenManager(TokenManager tokenManager)
Copyright © 2024. All rights reserved.