Package io.grpc
Class CompositeCallCredentials
- java.lang.Object
-
- io.grpc.CallCredentials
-
- io.grpc.CompositeCallCredentials
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1914") public final class CompositeCallCredentials extends CallCredentials
Uses multipleCallCredentials
as if they were one. If the first credential fails, the second will not be used. Both must succeed to allow the RPC.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CompositeCallCredentials.CombiningMetadataApplier
private class
CompositeCallCredentials.WrappingMetadataApplier
-
Nested classes/interfaces inherited from class io.grpc.CallCredentials
CallCredentials.MetadataApplier, CallCredentials.RequestInfo
-
-
Field Summary
Fields Modifier and Type Field Description private CallCredentials
credentials1
private CallCredentials
credentials2
-
Constructor Summary
Constructors Constructor Description CompositeCallCredentials(CallCredentials creds1, CallCredentials creds2)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyRequestMetadata(CallCredentials.RequestInfo requestInfo, java.util.concurrent.Executor appExecutor, CallCredentials.MetadataApplier applier)
Pass the credential data to the givenCallCredentials.MetadataApplier
, which will propagate it to the request metadata.-
Methods inherited from class io.grpc.CallCredentials
thisUsesUnstableApi
-
-
-
-
Field Detail
-
credentials1
private final CallCredentials credentials1
-
credentials2
private final CallCredentials credentials2
-
-
Constructor Detail
-
CompositeCallCredentials
public CompositeCallCredentials(CallCredentials creds1, CallCredentials creds2)
-
-
Method Detail
-
applyRequestMetadata
public void applyRequestMetadata(CallCredentials.RequestInfo requestInfo, java.util.concurrent.Executor appExecutor, CallCredentials.MetadataApplier applier)
Description copied from class:CallCredentials
Pass the credential data to the givenCallCredentials.MetadataApplier
, which will propagate it to the request metadata.It is called for each individual RPC, within the
Context
of the call, before the stream is about to be created on a transport. Implementations should not block in this method. If metadata is not immediately available, e.g., needs to be fetched from network, the implementation may give theappExecutor
an asynchronous task which will eventually call theapplier
. The RPC proceeds only after theapplier
is called.- Specified by:
applyRequestMetadata
in classCallCredentials
- Parameters:
requestInfo
- request-related informationappExecutor
- The application thread-pool. It is provided to the implementation in case it needs to perform blocking operations.applier
- The outlet of the produced headers. It can be called either before or after this method returns.
-
-