public class CredentialFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLOUD_BIGTABLE_ADMIN_SCOPE
The OAuth scope required to perform administrator actions such as creating tables.
|
static List<String> |
CLOUD_BIGTABLE_ALL_SCOPES
Scopes required for full access to cloud bigtable.
|
static List<String> |
CLOUD_BIGTABLE_READ_WRITE_SCOPES
Scopes required to read and write data from tables.
|
static String |
CLOUD_BIGTABLE_READER_SCOPE
The OAuth scope required to read data from tables.
|
static String |
CLOUD_BIGTABLE_WRITER_SCOPE
The OAuth scope required to write data to tables.
|
Constructor and Description |
---|
CredentialFactory() |
Modifier and Type | Method and Description |
---|---|
static com.google.auth.Credentials |
getApplicationDefaultCredential()
Initializes OAuth2 application default credentials based on the environment the code is running
in.
|
static com.google.auth.Credentials |
getCredentialFromMetadataServiceAccount()
Initializes OAuth2 credential using preconfigured ServiceAccount settings on the local
Google Compute Engine VM.
|
static com.google.auth.Credentials |
getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail,
String privateKeyFile)
Initializes OAuth2 credential from a private keyfile, as described in
Service accounts.
|
static com.google.auth.Credentials |
getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail,
String privateKeyFile,
List<String> scopes)
Initializes OAuth2 credential from a private keyfile, as described in
Service accounts.
|
static com.google.auth.Credentials |
getCredentials(CredentialOptions options)
Look up a Credentials object based on a configuration of credentials described in a
CredentialOptions . |
static com.google.auth.http.HttpTransportFactory |
getHttpTransportFactory() |
static com.google.auth.Credentials |
getInputStreamCredential(InputStream inputStream)
Initializes OAuth2 application default credentials based on an inputStream.
|
static void |
setHttpTransportFactory(com.google.auth.http.HttpTransportFactory httpTransportFactory)
Allow for an override of the credentials HttpTransportFactory.
|
public static final String CLOUD_BIGTABLE_ADMIN_SCOPE
public static final String CLOUD_BIGTABLE_READER_SCOPE
public static final String CLOUD_BIGTABLE_WRITER_SCOPE
public static final List<String> CLOUD_BIGTABLE_READ_WRITE_SCOPES
public static void setHttpTransportFactory(com.google.auth.http.HttpTransportFactory httpTransportFactory)
httpTransportFactory
- public static com.google.auth.http.HttpTransportFactory getHttpTransportFactory()
public static com.google.auth.Credentials getCredentials(CredentialOptions options) throws IOException, GeneralSecurityException
CredentialOptions
.options
- a CredentialOptions
object.Credentials
object.IOException
- if any.GeneralSecurityException
- if any.public static com.google.auth.Credentials getCredentialFromMetadataServiceAccount() throws IOException, GeneralSecurityException
Credentials
object.IOException
- if any.GeneralSecurityException
- if any.public static com.google.auth.Credentials getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail, String privateKeyFile) throws IOException, GeneralSecurityException
serviceAccountEmail
- Email address of the service account associated with the keyfile.privateKeyFile
- Full local path to private keyfile.Credentials
object.IOException
- if any.GeneralSecurityException
- if any.public static com.google.auth.Credentials getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail, String privateKeyFile, List<String> scopes) throws IOException, GeneralSecurityException
serviceAccountEmail
- Email address of the service account associated with the keyfile.privateKeyFile
- Full local path to private keyfile.scopes
- List of well-formed desired scopes to use with the credential.Credentials
object.IOException
- if any.GeneralSecurityException
- if any.public static com.google.auth.Credentials getApplicationDefaultCredential() throws IOException, GeneralSecurityException
Credentials
object.IOException
- if any.GeneralSecurityException
- if any.public static com.google.auth.Credentials getInputStreamCredential(InputStream inputStream) throws IOException, GeneralSecurityException
inputStream
- a InputStream
object.Credentials
object.IOException
- if any.GeneralSecurityException
- if any.