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
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private static class
Nested classes/interfaces inherited from class io.grpc.CallCredentials
io.grpc.CallCredentials.MetadataApplier, io.grpc.CallCredentials.RequestInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Class
<?> (package private) final com.google.auth.Credentials
private static final Class
<? extends com.google.auth.Credentials> private static final GoogleAuthLibraryCallCredentials.JwtHelper
private io.grpc.Metadata
private static final Logger
private final boolean
private final boolean
-
Constructor Summary
ConstructorsConstructorDescriptionGoogleAuthLibraryCallCredentials
(com.google.auth.Credentials creds) GoogleAuthLibraryCallCredentials
(com.google.auth.Credentials creds, GoogleAuthLibraryCallCredentials.JwtHelper jwtHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyRequestMetadata
(io.grpc.CallCredentials.RequestInfo info, Executor appExecutor, io.grpc.CallCredentials.MetadataApplier applier) (package private) static GoogleAuthLibraryCallCredentials.JwtHelper
createJwtHelperOrNull
(ClassLoader loader) boolean
This method is to support the hack for AppEngineCredentials which need to run on a specific thread.private static Class
<?> private static Class
<? extends com.google.auth.Credentials> private static URI
removePort
(URI uri) private static URI
serviceUri
(String authority, io.grpc.MethodDescriptor<?, ?> method) Generate a JWT-specific service URI.private static io.grpc.Metadata
Methods inherited from class io.grpc.CallCredentials
thisUsesUnstableApi
-
Field Details
-
log
-
jwtHelper
-
GOOGLE_CREDENTIALS_CLASS
-
APP_ENGINE_CREDENTIALS_CLASS
-
requirePrivacy
private final boolean requirePrivacy -
creds
final com.google.auth.Credentials creds -
lastHeaders
private io.grpc.Metadata lastHeaders -
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 classio.grpc.CallCredentials
-
serviceUri
private static URI serviceUri(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
- Throws:
io.grpc.StatusException
-
toHeaders
-
createJwtHelperOrNull
@Nullable static GoogleAuthLibraryCallCredentials.JwtHelper createJwtHelperOrNull(ClassLoader loader) -
loadGoogleCredentialsClass
-
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
-