Class OAuthCredentialsProvider
java.lang.Object
io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider
- All Implemented Interfaces:
CredentialsProvider
@ThreadSafe
public final class OAuthCredentialsProvider
extends Object
implements CredentialsProvider
This class is thread-safe in terms of the next: 1. If you are trying to modify headers of your
request from the several threads there would be sequential calls to the cache 2. If the cache
hasn't a valid token and you are calling from several threads there would be just one call to the
Auth server
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyCredentials
(io.grpc.Metadata headers) Adds an access token to the Authorization header of a gRPC call.boolean
shouldRetryRequest
(Throwable throwable) Returns true if the Throwable was caused by an UNAUTHENTICATED response and a new access token could be fetched; otherwise returns false.
-
Field Details
-
HEADER_AUTH_KEY
-
-
Method Details
-
applyCredentials
Adds an access token to the Authorization header of a gRPC call.- Specified by:
applyCredentials
in interfaceCredentialsProvider
- Parameters:
headers
- gRPC headers to be modified- Throws:
IOException
-
shouldRetryRequest
Returns true if the Throwable was caused by an UNAUTHENTICATED response and a new access token could be fetched; otherwise returns false.- Specified by:
shouldRetryRequest
in interfaceCredentialsProvider
- Parameters:
throwable
- error that caused the request to fail
-