RefreshingOAuth2CredentialsInterceptor (Cloud Bigtable HBase Client for Java 1.12.0 API)

com.google.cloud.bigtable.grpc.io

Class RefreshingOAuth2CredentialsInterceptor

  • java.lang.Object
    • com.google.cloud.bigtable.grpc.io.RefreshingOAuth2CredentialsInterceptor
  • All Implemented Interfaces:
    io.grpc.ClientInterceptor


    public class RefreshingOAuth2CredentialsInterceptor
    extends Object
    implements io.grpc.ClientInterceptor
    Client interceptor that authenticates all calls by binding header data provided by a credential. Typically this will populate the Authorization header but other headers may also be filled out.

    Uses the new and simplified Google auth library: https://github.com/google/google-auth-library-java

    TODO: COPIED FROM io.grpc.auth.ClientAuthInterceptor. The logic added here for initialization and locking could be moved back to gRPC. This implementation takes advantage of the fact that all of the Bigtable endpoints are OAuth2 based. It uses the OAuth AccessToken to get the token value and next refresh time. The refresh is scheduled asynchronously.

    Version:
    $Id: $Id
    Author:
    sduskis
    • Constructor Detail

      • RefreshingOAuth2CredentialsInterceptor

        public RefreshingOAuth2CredentialsInterceptor(ExecutorService scheduler,
                                                      com.google.auth.oauth2.OAuth2Credentials credentials)
        Constructor for RefreshingOAuth2CredentialsInterceptor.
        Parameters:
        scheduler - a ExecutorService object.
        credentials - a OAuth2Credentials object.
    • Method Detail

      • interceptCall

        public <ReqT,RespT> io.grpc.ClientCall<ReqT,RespT> interceptCall(io.grpc.MethodDescriptor<ReqT,RespT> method,
                                                                         io.grpc.CallOptions callOptions,
                                                                         io.grpc.Channel next)
        Specified by:
        interceptCall in interface io.grpc.ClientInterceptor