CredentialFactory (Cloud Bigtable HBase Client for Java 1.12.0 API)

com.google.cloud.bigtable.config

Class CredentialFactory



  • public class CredentialFactory
    extends Object
    Simple factory for creating OAuth Credential objects for use with Bigtable.
    Version:
    $Id: $Id
    Author:
    sduskis
    • Field Detail

      • CLOUD_BIGTABLE_ADMIN_SCOPE

        public static final String CLOUD_BIGTABLE_ADMIN_SCOPE
        The OAuth scope required to perform administrator actions such as creating tables.
        See Also:
        Constant Field Values
      • CLOUD_BIGTABLE_READER_SCOPE

        public static final String CLOUD_BIGTABLE_READER_SCOPE
        The OAuth scope required to read data from tables.
        See Also:
        Constant Field Values
      • CLOUD_BIGTABLE_WRITER_SCOPE

        public static final String CLOUD_BIGTABLE_WRITER_SCOPE
        The OAuth scope required to write data to tables.
        See Also:
        Constant Field Values
      • CLOUD_BIGTABLE_READ_WRITE_SCOPES

        public static final List<String> CLOUD_BIGTABLE_READ_WRITE_SCOPES
        Scopes required to read and write data from tables.
      • CLOUD_BIGTABLE_ALL_SCOPES

        public static final List<String> CLOUD_BIGTABLE_ALL_SCOPES
        Scopes required for full access to cloud bigtable.
    • Constructor Detail

      • CredentialFactory

        public CredentialFactory()
    • Method Detail

      • setHttpTransportFactory

        public static void setHttpTransportFactory(com.google.auth.http.HttpTransportFactory httpTransportFactory)
        Allow for an override of the credentials HttpTransportFactory.
        Parameters:
        httpTransportFactory -
      • getHttpTransportFactory

        public static com.google.auth.http.HttpTransportFactory getHttpTransportFactory()
      • getCredentialFromPrivateKeyServiceAccount

        public static com.google.auth.Credentials getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail,
                                                                                            String privateKeyFile)
                                                                                     throws IOException,
                                                                                            GeneralSecurityException
        Initializes OAuth2 credential from a private keyfile, as described in Service accounts.
        Parameters:
        serviceAccountEmail - Email address of the service account associated with the keyfile.
        privateKeyFile - Full local path to private keyfile.
        Returns:
        a Credentials object.
        Throws:
        IOException - if any.
        GeneralSecurityException - if any.
      • getCredentialFromPrivateKeyServiceAccount

        public static com.google.auth.Credentials getCredentialFromPrivateKeyServiceAccount(String serviceAccountEmail,
                                                                                            String privateKeyFile,
                                                                                            List<String> scopes)
                                                                                     throws IOException,
                                                                                            GeneralSecurityException
        Initializes OAuth2 credential from a private keyfile, as described in Service accounts.
        Parameters:
        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.
        Returns:
        a Credentials object.
        Throws:
        IOException - if any.
        GeneralSecurityException - if any.
      • getApplicationDefaultCredential

        public static com.google.auth.Credentials getApplicationDefaultCredential()
                                                                           throws IOException
        Initializes OAuth2 application default credentials based on the environment the code is running in. If a service account is to be used with JSON file, set the environment variable with name "GOOGLE_APPLICATION_CREDENTIALS" to the JSON file path. For more details on application default credentials: Application Default Credentials.
        Returns:
        a Credentials object.
        Throws:
        IOException - if any.
      • getInputStreamCredential

        public static com.google.auth.Credentials getInputStreamCredential(InputStream inputStream)
                                                                    throws IOException
        Initializes OAuth2 application default credentials based on an inputStream.
        Parameters:
        inputStream - a InputStream object.
        Returns:
        a Credentials object.
        Throws:
        IOException - if any.