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);
The contents and nature of this interface (and whether it remains an interface) is
experimental, in that it can change. However, we are guaranteeing stability for the
name. That is, we are guaranteeing stability for code to be returned a reference and
pass that reference to gRPC for usage. However, code may not call or implement the CallCredentials
itself if it wishes to only use stable APIs.
Modifier and Type | Interface and Description |
---|---|
static interface |
CallCredentials.MetadataApplier
Deprecated.
|
static class |
CallCredentials.RequestInfo
The request-related information passed to
CallCredentials2.applyRequestMetadata() . |
Modifier and Type | Field and Description |
---|---|
static Attributes.Key<String> |
ATTR_AUTHORITY
Deprecated.
|
static Attributes.Key<SecurityLevel> |
ATTR_SECURITY_LEVEL
Deprecated.
transport implementations should use
io.grpc.internal.GrpcAttributes.ATTR_SECURITY_LEVEL instead. |
Modifier and Type | Method and Description |
---|---|
void |
applyRequestMetadata(MethodDescriptor<?,?> method,
Attributes attrs,
Executor appExecutor,
CallCredentials.MetadataApplier applier)
Deprecated.
implement
CallCredentials2 instead. |
void |
thisUsesUnstableApi()
Should be a noop but never called; tries to make it clearer to implementors that they may break
in the future.
|
@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1914") @Grpc.TransportAttr @Deprecated static final Attributes.Key<SecurityLevel> ATTR_SECURITY_LEVEL
io.grpc.internal.GrpcAttributes.ATTR_SECURITY_LEVEL
instead.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.@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1914") @Grpc.TransportAttr @Deprecated 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.@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1914") @Deprecated void applyRequestMetadata(MethodDescriptor<?,?> method, Attributes attrs, Executor appExecutor, CallCredentials.MetadataApplier applier)
CallCredentials2
instead.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.@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1914") void thisUsesUnstableApi()
Copyright © 2018. All rights reserved.