Package io.openlineage.client.transports
Class OAuth2ClientCredentialsTokenProvider
java.lang.Object
io.openlineage.client.transports.TokenEndpointTokenProvider
io.openlineage.client.transports.OAuth2ClientCredentialsTokenProvider
- All Implemented Interfaces:
TokenProvider
TokenProvider that obtains an access token with the OAuth 2.0 client credentials grant (RFC 6749,
section 4.4).
The client credentials are sent in the Authorization header (
client_secret_basic, the default) or in the request body (client_secret_post). The
access token is cached and fetched again before it expires, as the client credentials grant does
not issue refresh tokens.
Configuration example:
transport:
type: http
url: https://api.example.com
auth:
type: oauth2
clientId: your-client-id
clientSecret: your-client-secret
tokenEndpoint: https://auth.example.com/token
scope: openid # optional
clientAuthMethod: client_secret_basic # optional, or client_secret_post
tokenRefreshBuffer: 120 # optional, defaults to 120 seconds
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOAuth2ClientCredentialsTokenProvider(String clientId, String clientSecret, URI tokenEndpoint) Constructor that requires mandatory parameters clientId, clientSecret and tokenEndpoint. -
Method Summary
Modifier and TypeMethodDescriptionHow the client credentials are sent to the token endpoint: "client_secret_basic" (HTTP basic Authorization header) or "client_secret_post" (request body).getScope()Space separated OAuth 2.0 scopes to request.protected StringName of the token used in log and error messages, for example "JWT token".protected StringValue of theAuthorizationheader sent to the token endpoint, or null for none.protected List<org.apache.hc.core5.http.NameValuePair>URL-encoded form parameters sent to the token endpoint.voidsetClientAuthMethod(String clientAuthMethod) voidSpace separated OAuth 2.0 scopes to request.toString()Methods inherited from class io.openlineage.client.transports.TokenEndpointTokenProvider
createHttpClient, getCurrentTimeSeconds, getExpiresInField, getToken, getTokenEndpoint, getTokenFields, getTokenRefreshBuffer, setExpiresInField, setTokenFields, setTokenRefreshBuffer
-
Field Details
-
CLIENT_SECRET_BASIC
- See Also:
-
CLIENT_SECRET_POST
- See Also:
-
-
Constructor Details
-
OAuth2ClientCredentialsTokenProvider
public OAuth2ClientCredentialsTokenProvider(String clientId, String clientSecret, URI tokenEndpoint) Constructor that requires mandatory parameters clientId, clientSecret and tokenEndpoint. Used by Jackson for deserialization.- Parameters:
clientId- The OAuth 2.0 client ID (required)clientSecret- The OAuth 2.0 client secret (required)tokenEndpoint- The token endpoint URI (required)- Throws:
IllegalArgumentException- if clientId or clientSecret is null/empty or tokenEndpoint is null
-
-
Method Details
-
setClientAuthMethod
-
getTokenName
Description copied from class:TokenEndpointTokenProviderName of the token used in log and error messages, for example "JWT token".- Specified by:
getTokenNamein classTokenEndpointTokenProvider
-
getTokenRequestParameters
Description copied from class:TokenEndpointTokenProviderURL-encoded form parameters sent to the token endpoint.- Specified by:
getTokenRequestParametersin classTokenEndpointTokenProvider
-
getTokenRequestAuthorization
Description copied from class:TokenEndpointTokenProviderValue of theAuthorizationheader sent to the token endpoint, or null for none.- Overrides:
getTokenRequestAuthorizationin classTokenEndpointTokenProvider
-
toString
- Overrides:
toStringin classTokenEndpointTokenProvider
-
getClientId
-
getClientSecret
-
getScope
Space separated OAuth 2.0 scopes to request. Optional. -
setScope
Space separated OAuth 2.0 scopes to request. Optional. -
getClientAuthMethod
How the client credentials are sent to the token endpoint: "client_secret_basic" (HTTP basic Authorization header) or "client_secret_post" (request body). Optional, default: "client_secret_basic".
-