Package io.grpc.auth

Class GoogleAuthLibraryCallCredentials

java.lang.Object
io.grpc.CallCredentials
io.grpc.auth.GoogleAuthLibraryCallCredentials
All Implemented Interfaces:
io.grpc.InternalMayRequireSpecificExecutor

final class GoogleAuthLibraryCallCredentials extends io.grpc.CallCredentials implements io.grpc.InternalMayRequireSpecificExecutor
Wraps Credentials as a CallCredentials.
  • Field Details

    • log

      private static final Logger log
    • jwtHelper

      private static final GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper
    • GOOGLE_CREDENTIALS_CLASS

      private static final Class<? extends com.google.auth.Credentials> GOOGLE_CREDENTIALS_CLASS
    • APP_ENGINE_CREDENTIALS_CLASS

      private static final Class<?> APP_ENGINE_CREDENTIALS_CLASS
    • requirePrivacy

      private final boolean requirePrivacy
    • creds

      final com.google.auth.Credentials creds
    • lastHeaders

      private io.grpc.Metadata lastHeaders
    • lastMetadata

      private Map<String,List<String>> lastMetadata
    • requiresSpecificExecutor

      private final boolean requiresSpecificExecutor
  • Constructor Details

    • GoogleAuthLibraryCallCredentials

      public GoogleAuthLibraryCallCredentials(com.google.auth.Credentials creds)
    • GoogleAuthLibraryCallCredentials

      GoogleAuthLibraryCallCredentials(com.google.auth.Credentials creds, GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper)
  • Method Details

    • applyRequestMetadata

      public void applyRequestMetadata(io.grpc.CallCredentials.RequestInfo info, Executor appExecutor, io.grpc.CallCredentials.MetadataApplier applier)
      Specified by:
      applyRequestMetadata in class io.grpc.CallCredentials
    • serviceUri

      private static URI serviceUri(String authority, io.grpc.MethodDescriptor<?,?> method) throws io.grpc.StatusException
      Generate a JWT-specific service URI. The URI is simply an identifier with enough information for a service to know that the JWT was intended for it. The URI will commonly be verified with a simple string equality check.
      Throws:
      io.grpc.StatusException
    • removePort

      private static URI removePort(URI uri) throws io.grpc.StatusException
      Throws:
      io.grpc.StatusException
    • toHeaders

      private static io.grpc.Metadata toHeaders(@Nullable Map<String,List<String>> metadata)
    • createJwtHelperOrNull

      @Nullable static GoogleAuthLibraryCallCredentials.JwtHelper createJwtHelperOrNull(ClassLoader loader)
    • loadGoogleCredentialsClass

      @Nullable private static Class<? extends com.google.auth.Credentials> loadGoogleCredentialsClass()
    • loadAppEngineCredentials

      @Nullable private static Class<?> loadAppEngineCredentials()
    • isSpecificExecutorRequired

      public boolean isSpecificExecutorRequired()
      This method is to support the hack for AppEngineCredentials which need to run on a specific thread.
      Specified by:
      isSpecificExecutorRequired in interface io.grpc.InternalMayRequireSpecificExecutor
      Returns:
      Whether a specific executor is needed or if any executor can be used