Package io.grpc.auth

Class GoogleAuthLibraryCallCredentials

  • All Implemented Interfaces:
    io.grpc.InternalMayRequireSpecificExecutor

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

      • log

        private static final java.util.logging.Logger log
      • GOOGLE_CREDENTIALS_CLASS

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

        private static final java.lang.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 java.util.Map<java.lang.String,​java.util.List<java.lang.String>> lastMetadata
      • requiresSpecificExecutor

        private final boolean requiresSpecificExecutor
    • Constructor Detail

      • GoogleAuthLibraryCallCredentials

        public GoogleAuthLibraryCallCredentials​(com.google.auth.Credentials creds)
    • Method Detail

      • applyRequestMetadata

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

        private static java.net.URI serviceUri​(java.lang.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 java.net.URI removePort​(java.net.URI uri)
                                        throws io.grpc.StatusException
        Throws:
        io.grpc.StatusException
      • toHeaders

        private static io.grpc.Metadata toHeaders​(@Nullable
                                                  java.util.Map<java.lang.String,​java.util.List<java.lang.String>> metadata)
      • loadGoogleCredentialsClass

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

        @Nullable
        private static java.lang.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