public class HttpAccessTokenRetriever extends Object implements AccessTokenRetriever
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
).Modifier and Type | Field and Description |
---|---|
static String |
AUTHORIZATION_HEADER |
Constructor and Description |
---|
HttpAccessTokenRetriever(String clientId,
String clientSecret,
String scope,
SSLSocketFactory sslSocketFactory,
String tokenEndpointUrl,
long loginRetryBackoffMs,
long loginRetryBackoffMaxMs,
Integer loginConnectTimeoutMs,
Integer loginReadTimeoutMs) |
Modifier and Type | Method and Description |
---|---|
static String |
post(HttpURLConnection con,
Map<String,String> headers,
String requestBody,
Integer connectTimeoutMs,
Integer readTimeoutMs) |
String |
retrieve()
Retrieves a JWT access token in its serialized three-part form.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public static final String AUTHORIZATION_HEADER
public String retrieve() throws IOException
LoginModule
from which this is ultimately called
does not provide an asynchronous approach.retrieve
in interface AccessTokenRetriever
null
JWT access token stringIOException
- Thrown on errors related to IO during retrievalpublic static String post(HttpURLConnection con, Map<String,String> headers, String requestBody, Integer connectTimeoutMs, Integer readTimeoutMs) throws IOException, UnretryableException
IOException
UnretryableException