Class HttpAccessTokenRetriever
java.lang.Object
org.apache.kafka.common.security.oauthbearer.secured.HttpAccessTokenRetriever
- All Implemented Interfaces:
Closeable,AutoCloseable,AccessTokenRetriever,Initable
HttpAccessTokenRetriever is an AccessTokenRetriever that will
communicate with an OAuth/OIDC provider directly via HTTP to post client credentials
(OAuthBearerLoginCallbackHandler.CLIENT_ID_CONFIG/OAuthBearerLoginCallbackHandler.CLIENT_SECRET_CONFIG)
to a publicized token endpoint URL
(SaslConfigs.SASL_OAUTHBEARER_TOKEN_ENDPOINT_URL).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpAccessTokenRetriever(String clientId, String clientSecret, String scope, SSLSocketFactory sslSocketFactory, String tokenEndpointUrl, long loginRetryBackoffMs, long loginRetryBackoffMaxMs, Integer loginConnectTimeoutMs, Integer loginReadTimeoutMs) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.security.oauthbearer.secured.AccessTokenRetriever
close
-
Field Details
-
AUTHORIZATION_HEADER
- See Also:
-
-
Constructor Details
-
HttpAccessTokenRetriever
-
-
Method Details
-
retrieve
Retrieves a JWT access token in its serialized three-part form. The implementation is free to determine how it should be retrieved but should not perform validation on the result. Note: This is a blocking function and callers should be aware that the implementation communicates over a network. The facility in theLoginModulefrom which this is ultimately called does not provide an asynchronous approach.- Specified by:
retrievein interfaceAccessTokenRetriever- Returns:
- Non-
nullJWT access token string - Throws:
IOException- Thrown on errors related to IO during retrieval
-
post
public static String post(HttpURLConnection con, Map<String, String> headers, String requestBody, Integer connectTimeoutMs, Integer readTimeoutMs) throws IOException, UnretryableException- Throws:
IOExceptionUnretryableException
-