public class OAuthAuthenticator
extends java.lang.Object
TokenInfo object.| Constructor and Description |
|---|
OAuthAuthenticator() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
base64decode(java.lang.String value)
A helper method to decode a base64 encoded string
|
static java.lang.String |
base64encode(java.lang.String value)
A helper method to base64 encode a given string
|
static TokenInfo |
loginWithAccessToken(java.lang.String token,
boolean isJwt,
PrincipalExtractor principalExtractor)
Wrap an access token into TokenInfo extracting information from the token if it is a JWT token.
|
static TokenInfo |
loginWithClientAssertion(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String clientId,
java.lang.String clientAssertion,
java.lang.String clientAssertionType,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using client_credentials grant with client assertion (clientId + assertion + assertion type),
and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithClientAssertion(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String clientId,
java.lang.String clientAssertion,
java.lang.String clientAssertionType,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
MetricsHandler metrics,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using client_credentials grant with client assertion (clientId + assertion + assertion type).
|
static TokenInfo |
loginWithClientSecret(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using client_credentials grant (clientId + secret), and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithClientSecret(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using client_credentials grant (clientId + secret), and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithClientSecret(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
MetricsHandler metrics,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using client_credentials grant (clientId + secret).
|
static TokenInfo |
loginWithPassword(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String username,
java.lang.String password,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using password grant (username + password), and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithPassword(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String username,
java.lang.String password,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using password grant (username + password).
|
static TokenInfo |
loginWithPassword(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String username,
java.lang.String password,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
MetricsHandler metrics,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using password grant (username + password).
|
static TokenInfo |
loginWithRefreshToken(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String refreshToken,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using a refresh token, and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithRefreshToken(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String refreshToken,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
boolean includeAcceptHeader)
Obtain an access token wrapped into TokenInfo by authenticating to the authorization server's token endpoint
using a refresh token, and connect and read timeouts of 60 seconds.
|
static TokenInfo |
loginWithRefreshToken(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String refreshToken,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader) |
static TokenInfo |
loginWithRefreshToken(java.net.URI tokenEndpointUrl,
javax.net.ssl.SSLSocketFactory socketFactory,
javax.net.ssl.HostnameVerifier hostnameVerifier,
java.lang.String refreshToken,
java.lang.String clientId,
java.lang.String clientSecret,
boolean isJwt,
PrincipalExtractor principalExtractor,
java.lang.String scope,
java.lang.String audience,
int connectTimeout,
int readTimeout,
MetricsHandler metrics,
int retries,
long retryPauseMillis,
boolean includeAcceptHeader) |
static java.lang.String |
urlencode(java.lang.String value)
A helper method to urlencode a given value
|
public static TokenInfo loginWithAccessToken(java.lang.String token, boolean isJwt, PrincipalExtractor principalExtractor)
token - A raw access tokenisJwt - If the access token is a JWT tokenprincipalExtractor - A PrincipalExtractor used to extract the principal (user id)public static TokenInfo loginWithClientSecret(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'clientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithClientSecret(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'clientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithClientSecret(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, MetricsHandler metrics, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'clientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsmetrics - A MetricsHandler object to receive metrics collection callbacksretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithClientAssertion(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String clientId, java.lang.String clientAssertion, java.lang.String clientAssertionType, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'clientId - A client idclientAssertion - A client assertionclientAssertionType - A client assertion typeisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithClientAssertion(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String clientId, java.lang.String clientAssertion, java.lang.String clientAssertionType, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, MetricsHandler metrics, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'clientId - A client idclientAssertion - A client assertionclientAssertionType - A client assertion typeisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsmetrics - A MetricsHandler object to receive metrics collection callbacksretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithPassword(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String username, java.lang.String password, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'username - A usernamepassword - A passwordclientId - A client idclientSecret - A (optional) client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithPassword(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String username, java.lang.String password, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'username - A usernamepassword - A passwordclientId - A client idclientSecret - A (optional) client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithPassword(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String username, java.lang.String password, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, MetricsHandler metrics, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'username - A usernamepassword - A passwordclientId - A client idclientSecret - A (optional) client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsmetrics - A MetricsHandler object to receive metrics collection callbacksretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithRefreshToken(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String refreshToken, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'refreshToken - A refresh tokenclientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithRefreshToken(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String refreshToken, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'refreshToken - A refresh tokenclientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithRefreshToken(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String refreshToken, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'refreshToken - A refresh tokenclientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static TokenInfo loginWithRefreshToken(java.net.URI tokenEndpointUrl, javax.net.ssl.SSLSocketFactory socketFactory, javax.net.ssl.HostnameVerifier hostnameVerifier, java.lang.String refreshToken, java.lang.String clientId, java.lang.String clientSecret, boolean isJwt, PrincipalExtractor principalExtractor, java.lang.String scope, java.lang.String audience, int connectTimeout, int readTimeout, MetricsHandler metrics, int retries, long retryPauseMillis, boolean includeAcceptHeader) throws java.io.IOException
tokenEndpointUrl - A token endpoint urlsocketFactory - A socket factory to use with 'https'hostnameVerifier - A hostname verifier to use with 'https'refreshToken - A refresh tokenclientId - A client idclientSecret - A client secretisJwt - If the returned token is expected to be a JWT tokenprincipalExtractor - A PrincipalExtractor to use to determine the principal (user id)scope - A scope to request when authenticatingaudience - An 'audience' attribute to set on the request when authenticatingconnectTimeout - A connect timeout in secondsreadTimeout - A read timeout in secondsmetrics - A MetricsHandler object to receive metrics collection callbacksretries - A maximum number of retries if the request fails due to network, or unexpected response statusretryPauseMillis - A pause between consecutive requestsincludeAcceptHeader - Should we skip sending the Accept header when making outbound http requestsjava.io.IOException - If the request to the authorization server has failedjava.lang.IllegalStateException - If the response from the authorization server could not be handledpublic static java.lang.String base64encode(java.lang.String value)
value - A string to encode as base64public static java.lang.String base64decode(java.lang.String value)
value - A string to decode from base64public static java.lang.String urlencode(java.lang.String value)
value - A string to urlencodeCopyright © 2024. All rights reserved.