Top Description Inners Constructors Methods
io.grpc

public abstract Class CallCredentials

extends Object
Class Inheritance
Known Direct Subclasses
io.grpc.CompositeCallCredentials
Imports
java.util.concurrent.Executor

Carries credential data that will be propagated to the server via request metadata for each RPC.

This is used by CallOptions#withCallCredentials 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 class (and whether it remains an abstract class) 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
CallCredentials.MetadataApplier

The outlet of the produced headers.

public abstract static class
CallCredentials.RequestInfo

The request-related information passed to CallCredentials.applyRequestMetadata().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
applyRequestMetadata(CallCredentials.RequestInfo
request-related information
requestInfo
,
Executor
The application thread-pool. It is provided to the implementation in case it needs to perform blocking operations.
appExecutor
,
CallCredentials.MetadataApplier
The outlet of the produced headers. It can be called either before or after this method returns.
applier
)

Pass the credential data to the given CallCredentials.MetadataApplier, which will propagate it to the request metadata.

public void
thisUsesUnstableApi()

Deprecated
With this class now being stable this method moves from an abstract one to a normal one with a no-op implementation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CallCredentialsback to summary
public CallCredentials()

Method Detail

applyRequestMetadataback to summary
public abstract void applyRequestMetadata(CallCredentials.RequestInfo requestInfo, Executor appExecutor, CallCredentials.MetadataApplier applier)

Pass the credential data to the given 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.

Parameters
requestInfo:CallCredentials.RequestInfo

request-related information

appExecutor:Executor

The application thread-pool. It is provided to the implementation in case it needs to perform blocking operations.

applier:CallCredentials.MetadataApplier

The outlet of the produced headers. It can be called either before or after this method returns.

thisUsesUnstableApiback to summary
public void thisUsesUnstableApi()

Deprecated

With this class now being stable this method moves from an abstract one to a normal one with a no-op implementation. This method is marked deprecated to allow extenders time to remove the method before it is removed here.

Annotations
@ExperimentalApi:https://github.com/grpc/grpc-java/issues/1914
@Deprecated
io.grpc back to summary

public abstract Class CallCredentials.MetadataApplier

extends Object
Class Inheritance
Known Direct Subclasses
io.grpc.CompositeCallCredentials.WrappingMetadataApplier, io.grpc.CompositeCallCredentials.CombiningMetadataApplier

The outlet of the produced headers. Not thread-safe.

Exactly one of its methods must be called to make the RPC proceed.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
apply(Metadata headers)

Called when headers are successfully generated.

public abstract void
fail(Status status)

Called when there has been an error when preparing the headers.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MetadataApplierback to summary
public MetadataApplier()

Method Detail

applyback to summary
public abstract void apply(Metadata headers)

Called when headers are successfully generated. They will be merged into the original headers.

failback to summary
public abstract void fail(Status status)

Called when there has been an error when preparing the headers. This will fail the RPC.

io.grpc back to summary

public abstract Class CallCredentials.RequestInfo

extends Object
Class Inheritance

The request-related information passed to CallCredentials.applyRequestMetadata().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract String
getAuthority()

Returns the authority string used to authenticate the server for this call.

public CallOptions
getCallOptions()

The call options used to call this RPC.

public abstract MethodDescriptor<?, ?>
getMethodDescriptor()

The method descriptor of this RPC.

public abstract SecurityLevel
getSecurityLevel()

The security level on the transport.

public abstract Attributes
getTransportAttrs()

Returns the transport attributes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RequestInfoback to summary
public RequestInfo()

Method Detail

getAuthorityback to summary
public abstract String getAuthority()

Returns the authority string used to authenticate the server for this call.

getCallOptionsback to summary
public CallOptions getCallOptions()

The call options used to call this RPC.

getMethodDescriptorback to summary
public abstract MethodDescriptor<?, ?> getMethodDescriptor()

The method descriptor of this RPC.

getSecurityLevelback to summary
public abstract SecurityLevel getSecurityLevel()

The security level on the transport.

getTransportAttrsback to summary
public abstract Attributes getTransportAttrs()

Returns the transport attributes.

Annotations
@TransportAttr