public class CredentialOptions extends Object implements Serializable
This class encapsulates the method the Cloud Bigtable client should use to look up
Credentials
. Here are the credential types supported:
CredentialFactory for more details on
how CredentialOptions are used to create a {@link com.google.auth.Credentials}.
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
CredentialOptions.CredentialType |
static class |
CredentialOptions.JsonCredentialsOptions
A CredentialOption that has a json credentials configured as an InputStream instead of a system
environment property.
|
static class |
CredentialOptions.P12CredentialOptions
A CredentialOptions defined by a serviceAccount and a p12 key file.
|
static class |
CredentialOptions.UserSuppliedCredentialOptions
A CredentialOption that supplies the Credentials directly.
|
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG
Constant
LOG |
static String |
SERVICE_ACCOUNT_JSON_ENV_VARIABLE
Constant
SERVICE_ACCOUNT_JSON_ENV_VARIABLE="GOOGLE_APPLICATION_CREDENTIALS" |
Modifier and Type | Method and Description |
---|---|
static CredentialOptions |
credential(com.google.auth.Credentials credentials)
A CredentialOption that wraps an existing
Credentials object. |
static CredentialOptions |
defaultCredentials()
Use the Application Default Credentials which are credentials that identify and authorize the
whole application.
|
boolean |
equals(Object obj) |
CredentialOptions.CredentialType |
getCredentialType()
Getter for the field
credentialType . |
static String |
getEnvJsonFile()
Get a configured json credentials file from the GOOGLE_APPLICATION_CREDENTIALS environment
variable.
|
static CredentialOptions |
jsonCredentials(InputStream jsonInputStream)
jsonCredentials.
|
static CredentialOptions |
jsonCredentials(String jsonString)
jsonCredentials.
|
static CredentialOptions |
nullCredential()
No credentials - used for unit testing.
|
static CredentialOptions |
p12Credential(String serviceAccount,
String keyFile)
Initializes OAuth2 credential from a private keyfile, as described in Service accounts.
|
public static final String SERVICE_ACCOUNT_JSON_ENV_VARIABLE
SERVICE_ACCOUNT_JSON_ENV_VARIABLE="GOOGLE_APPLICATION_CREDENTIALS"
protected static final Logger LOG
LOG
public static CredentialOptions jsonCredentials(InputStream jsonInputStream)
jsonCredentials.
jsonInputStream
- a InputStream
object.CredentialOptions
object.public static CredentialOptions jsonCredentials(String jsonString)
jsonCredentials.
jsonString
- a String
object.CredentialOptions
object.public static String getEnvJsonFile()
String
object.public static CredentialOptions defaultCredentials()
Use the Application Default Credentials which are credentials that identify and authorize the whole application. This is the built-in service account if running on Google Compute Engine. Alternatively, the credentials file from the path in the environment variable GOOGLE_APPLICATION_CREDENTIAL. If GOOGLE_APPLICATION_CREDENTIAL is not set, look at the gcloud/application_default_credentials.json file in the (User)/APPDATA/ directory on Windows or ~/.config/ directory on other OSs .
Initializes OAuth2 credential using preconfigured ServiceAccount settings on the local Google Compute Engine VM. See: Creating and Enabling Service Accounts for Instances.CredentialOptions
object.public static CredentialOptions p12Credential(String serviceAccount, String keyFile)
serviceAccount
- a String
object.keyFile
- a String
object.CredentialOptions
object.public static CredentialOptions credential(com.google.auth.Credentials credentials)
Credentials
object.credentials
- a Credentials
object.CredentialOptions
object.public static CredentialOptions nullCredential()
CredentialOptions
object.public CredentialOptions.CredentialType getCredentialType()
Getter for the field credentialType
.
CredentialOptions.CredentialType
object.