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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.client.CredentialsProvider
CredentialsProvider.CredentialsApplier, CredentialsProvider.StatusCode -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an access token to the Authorization header of a gRPC call.booleanshouldRetryRequest(CredentialsProvider.StatusCode statusCode) Returns true if the request failed because it was unauthenticated or unauthorized, and a new access token could be fetched; otherwise returns false.
-
Method Details
-
applyCredentials
Adds an access token to the Authorization header of a gRPC call.- Specified by:
applyCredentialsin interfaceCredentialsProvider- Parameters:
applier- where to add the credentials headers- Throws:
IOException
-
shouldRetryRequest
Returns true if the request failed because it was unauthenticated or unauthorized, and a new access token could be fetched; otherwise returns false.- Specified by:
shouldRetryRequestin interfaceCredentialsProvider- Parameters:
statusCode- the response code for the failure
-