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.InternalMayRequireSpecificExecutorWrapsCredentialsas aCallCredentials.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classGoogleAuthLibraryCallCredentials.JwtHelperprivate static classGoogleAuthLibraryCallCredentials.MethodPair
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class<?>APP_ENGINE_CREDENTIALS_CLASS(package private) com.google.auth.Credentialscredsprivate static java.lang.Class<? extends com.google.auth.Credentials>GOOGLE_CREDENTIALS_CLASSprivate static GoogleAuthLibraryCallCredentials.JwtHelperjwtHelperprivate io.grpc.MetadatalastHeadersprivate java.util.Map<java.lang.String,java.util.List<java.lang.String>>lastMetadataprivate static java.util.logging.Loggerlogprivate booleanrequirePrivacyprivate booleanrequiresSpecificExecutor
-
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 voidapplyRequestMetadata(io.grpc.CallCredentials.RequestInfo info, java.util.concurrent.Executor appExecutor, io.grpc.CallCredentials.MetadataApplier applier)(package private) static GoogleAuthLibraryCallCredentials.JwtHelpercreateJwtHelperOrNull(java.lang.ClassLoader loader)booleanisSpecificExecutorRequired()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.URIremovePort(java.net.URI uri)private static java.net.URIserviceUri(java.lang.String authority, io.grpc.MethodDescriptor<?,?> method)Generate a JWT-specific service URI.private static io.grpc.MetadatatoHeaders(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:
applyRequestMetadatain classio.grpc.CallCredentials
-
serviceUri
private static java.net.URI serviceUri(java.lang.String authority, io.grpc.MethodDescriptor<?,?> method) throws io.grpc.StatusExceptionGenerate 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:
isSpecificExecutorRequiredin interfaceio.grpc.InternalMayRequireSpecificExecutor- Returns:
- Whether a specific executor is needed or if any executor can be used
-
-