Package s2.auth
Class BearerTokenCallCredentials
java.lang.Object
io.grpc.CallCredentials
s2.auth.BearerTokenCallCredentials
public class BearerTokenCallCredentials
extends io.grpc.CallCredentials
Implementation of CallCredentials that adds a bearer token to request metadata. This class is
 used to authenticate gRPC requests using a bearer token in the Authorization header with the
 "Bearer" scheme.
- 
Nested Class Summary
Nested classes/interfaces inherited from class io.grpc.CallCredentials
io.grpc.CallCredentials.MetadataApplier, io.grpc.CallCredentials.RequestInfo - 
Constructor Summary
ConstructorsConstructorDescriptionBearerTokenCallCredentials(String token) Creates new bearer token credentials. - 
Method Summary
Modifier and TypeMethodDescriptionvoidapplyRequestMetadata(io.grpc.CallCredentials.RequestInfo requestInfo, Executor executor, io.grpc.CallCredentials.MetadataApplier metadataApplier) Applies the bearer token to the request metadata.booleanReturns whether this credentials implementation is equal to another object.inthashCode()Returns a hash code value for this credentials implementation.Methods inherited from class io.grpc.CallCredentials
thisUsesUnstableApi 
- 
Constructor Details
- 
BearerTokenCallCredentials
Creates new bearer token credentials.- Parameters:
 token- The bearer token to use for authentication- Throws:
 IllegalArgumentException- if token is null or empty
 
 - 
 - 
Method Details
- 
applyRequestMetadata
public void applyRequestMetadata(io.grpc.CallCredentials.RequestInfo requestInfo, Executor executor, io.grpc.CallCredentials.MetadataApplier metadataApplier) Applies the bearer token to the request metadata. This method is called by the gRPC framework before each request.- Specified by:
 applyRequestMetadatain classio.grpc.CallCredentials- Parameters:
 requestInfo- Information about the RPC being calledexecutor- The executor to use for any asynchronous operationsmetadataApplier- Interface for applying the resulting metadata
 - 
hashCode
public int hashCode()Returns a hash code value for this credentials implementation. - 
equals
Returns whether this credentials implementation is equal to another object. Two BearerTokenCallCredentials are equal if they have the same token. 
 -