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
WrapsCredentials
as aCallCredentials
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
GoogleAuthLibraryCallCredentials.JwtHelper
private static class
GoogleAuthLibraryCallCredentials.MethodPair
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class<?>
APP_ENGINE_CREDENTIALS_CLASS
(package private) com.google.auth.Credentials
creds
private static java.lang.Class<? extends com.google.auth.Credentials>
GOOGLE_CREDENTIALS_CLASS
private static GoogleAuthLibraryCallCredentials.JwtHelper
jwtHelper
private io.grpc.Metadata
lastHeaders
private java.util.Map<java.lang.String,java.util.List<java.lang.String>>
lastMetadata
private static java.util.logging.Logger
log
private boolean
requirePrivacy
private boolean
requiresSpecificExecutor
-
Constructor Summary
Constructors Constructor Description GoogleAuthLibraryCallCredentials(com.google.auth.Credentials creds)
GoogleAuthLibraryCallCredentials(com.google.auth.Credentials creds, GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyRequestMetadata(io.grpc.CallCredentials.RequestInfo info, java.util.concurrent.Executor appExecutor, io.grpc.CallCredentials.MetadataApplier applier)
(package private) static GoogleAuthLibraryCallCredentials.JwtHelper
createJwtHelperOrNull(java.lang.ClassLoader loader)
boolean
isSpecificExecutorRequired()
This method is to support the hack for AppEngineCredentials which need to run on a specific thread.private static java.lang.Class<?>
loadAppEngineCredentials()
private static java.lang.Class<? extends com.google.auth.Credentials>
loadGoogleCredentialsClass()
private static java.net.URI
removePort(java.net.URI uri)
private static java.net.URI
serviceUri(java.lang.String authority, io.grpc.MethodDescriptor<?,?> method)
Generate a JWT-specific service URI.private static io.grpc.Metadata
toHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
-
-
-
Field Detail
-
log
private static final java.util.logging.Logger log
-
jwtHelper
private static final GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper
-
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)
-
GoogleAuthLibraryCallCredentials
GoogleAuthLibraryCallCredentials(com.google.auth.Credentials creds, GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper)
-
-
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 classio.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)
-
createJwtHelperOrNull
@Nullable static GoogleAuthLibraryCallCredentials.JwtHelper createJwtHelperOrNull(java.lang.ClassLoader loader)
-
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 interfaceio.grpc.InternalMayRequireSpecificExecutor
- Returns:
- Whether a specific executor is needed or if any executor can be used
-
-