public abstract class BigtableOAuth2Credentials extends Object
Credentials
implementation for auth purposes. Clients can't directly override
the Credentials
class as it is shaded by Cloud Bigtable client.
Hence, customers should implement this class, which will be used for authentication. The authentication should be based on OAuth2 and must work by just including request metadata with each request at transport layer.
Constructor and Description |
---|
BigtableOAuth2Credentials(org.apache.hadoop.conf.Configuration configuration)
All subclasses must implement this constructor and populate the @configuration.
|
Modifier and Type | Method and Description |
---|---|
abstract Map<String,List<String>> |
getRequestMetadata(URI uri)
Get the current request metadata.
|
static com.google.auth.Credentials |
newInstance(Class<? extends BigtableOAuth2Credentials> bigtableAuthClass,
org.apache.hadoop.conf.Configuration conf)
Creates a new instance of a child of @
BigtableOAuth2Credentials . |
public BigtableOAuth2Credentials(org.apache.hadoop.conf.Configuration configuration)
configuration
- The HBase configurationpublic abstract Map<String,List<String>> getRequestMetadata(URI uri) throws IOException
This should be called by the transport layer on each request, and the data should be populated in headers or other context.
This method should provide all the headers that @OAuth2Credentials
provides.
This class should handle caching and refreshing of the metadata associated with the request. Ideally, caching and refreshing of credentials should happen in an asynchronous non-blocking way.
uri
- URI of the entry point for the request.IOException
@InternalApi(value="For internal usage only") public static com.google.auth.Credentials newInstance(Class<? extends BigtableOAuth2Credentials> bigtableAuthClass, org.apache.hadoop.conf.Configuration conf)
BigtableOAuth2Credentials
.bigtableAuthClass
- the child class to be instantiatedconf
- HBase configuration required to configure the @bigtableAuthClass