@ExperimentalApi(value="https//github.com/grpc/grpc-java/issues/1914") public interface CallCredentials
This is used by CallOptions.withCallCredentials(io.grpc.CallCredentials)
and withCallCredentials()
on
the generated stub, for example:
FooGrpc.FooStub stub = FooGrpc.newStub(channel); response = stub.withCallCredentials(creds).bar(request);
Modifier and Type | Interface and Description |
---|---|
static interface |
CallCredentials.MetadataApplier
The outlet of the produced headers.
|
Modifier and Type | Field and Description |
---|---|
static Attributes.Key<String> |
ATTR_AUTHORITY
The authority string used to authenticate the server.
|
static Attributes.Key<SecurityLevel> |
ATTR_SECURITY_LEVEL
The security level of the transport.
|
Modifier and Type | Method and Description |
---|---|
void |
applyRequestMetadata(MethodDescriptor<?,?> method,
Attributes attrs,
Executor appExecutor,
CallCredentials.MetadataApplier applier)
Pass the credential data to the given
CallCredentials.MetadataApplier , which will propagate it to
the request metadata. |
static final Attributes.Key<SecurityLevel> ATTR_SECURITY_LEVEL
attrs
passed
to applyRequestMetadata(io.grpc.MethodDescriptor<?, ?>, io.grpc.Attributes, java.util.concurrent.Executor, io.grpc.CallCredentials.MetadataApplier)
. It is by default SecurityLevel.NONE
but can be
overridden by the transport.static final Attributes.Key<String> ATTR_AUTHORITY
attrs
passed to applyRequestMetadata(io.grpc.MethodDescriptor<?, ?>, io.grpc.Attributes, java.util.concurrent.Executor, io.grpc.CallCredentials.MetadataApplier)
. It is
by default from the channel, but can be overridden by the transport and CallOptions
with increasing precedence.void applyRequestMetadata(MethodDescriptor<?,?> method, Attributes attrs, Executor appExecutor, CallCredentials.MetadataApplier applier)
CallCredentials.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 the applier
to an asynchronous task which will eventually call
the applier
. The RPC proceeds only after the applier
is called.
method
- The method descriptor of this RPCattrs
- Additional attributes from the transport, along with the keys defined in this
interface (i.e. the ATTR_*
fields) which are guaranteed to be present.appExecutor
- 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.