public final class OAuthClientUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
OAuthClientUtils.Consumer
Simple consumer representation
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createAuthorizationHeader(ClientAccessToken accessToken)
Creates OAuth Authorization header with Bearer scheme
|
static String |
createAuthorizationHeader(ClientAccessToken accessToken,
HttpRequestProperties httpProps)
Creates OAuth Authorization header with the scheme that
may require an access to the current HTTP request properties
|
static ClientAccessToken |
fromMapToClientToken(Map<String,String> map) |
static ClientAccessToken |
fromMapToClientToken(Map<String,String> map,
String defaultTokenType) |
static ClientAccessToken |
getAccessToken(String accessTokenServiceUri,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant,
boolean setAuthorizationHeader)
Obtains the access token from OAuth AccessToken Service
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
AccessTokenGrant grant)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
AccessTokenGrant grant,
Map<String,String> extraParams)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant,
boolean setAuthorizationHeader)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant,
Map<String,String> extraParams,
boolean setAuthorizationHeader)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static ClientAccessToken |
getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant,
Map<String,String> extraParams,
String defaultTokenType,
boolean setAuthorizationHeader)
Obtains the access token from OAuth AccessToken Service
using the initialized web client
|
static URI |
getAuthorizationURI(String authorizationServiceURI,
String clientId,
String redirectUri,
String state,
String scope)
Builds a complete URI for redirecting to OAuth Authorization Service
|
static javax.ws.rs.core.UriBuilder |
getAuthorizationURIBuilder(String authorizationServiceURI,
String clientId,
String scope)
Creates the builder for building OAuth AuthorizationService URIs
|
static ClientAccessToken |
refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
ClientAccessToken at) |
static ClientAccessToken |
refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
ClientAccessToken at) |
static ClientAccessToken |
refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
ClientAccessToken at,
String scope,
boolean setAuthorizationHeader) |
static void |
setAuthorizationHeader(org.apache.cxf.jaxrs.client.WebClient wc,
ClientAccessToken accessToken) |
static void |
setAuthorizationHeader(org.apache.cxf.jaxrs.client.WebClient wc,
ClientAccessToken accessToken,
String httpVerb) |
public static URI getAuthorizationURI(String authorizationServiceURI, String clientId, String redirectUri, String state, String scope)
authorizationServiceURI - the service endpoint addressclientId - client registration idredirectUri - the uri the authorization code will be posted tostate - the client state, example the key or the encrypted token
representing the info about the current end user's requestpublic static javax.ws.rs.core.UriBuilder getAuthorizationURIBuilder(String authorizationServiceURI, String clientId, String scope)
authorizationServiceURI - the service endpoint addressclientId - client registration idscope - the optional scope; if not specified then the authorization
service will allocate the default scopepublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant) throws OAuthServiceException
accessTokenService - the AccessToken clientconsumer - OAuthClientUtils.Consumer representing the registered clientgrant - AccessTokenGrant grantClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken getAccessToken(String accessTokenServiceUri, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant, boolean setAuthorizationHeader) throws OAuthServiceException
accessTokenServiceUri - the AccessToken endpoint addressconsumer - OAuthClientUtils.Consumer representing the registered clientgrant - AccessTokenGrant grantsetAuthorizationHeader - if set to true then HTTP Basic scheme
will be used to pass client id and secret, otherwise they will
be passed in the form payloadClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant, boolean setAuthorizationHeader)
accessTokenService - the AccessToken clientconsumer - OAuthClientUtils.Consumer representing the registered client.grant - AccessTokenGrant grantsetAuthorizationHeader - if set to true then HTTP Basic scheme
will be used to pass client id and secret, otherwise they will
be passed in the form payloadClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, AccessTokenGrant grant) throws OAuthServiceException
accessTokenService - the AccessToken clientgrant - AccessTokenGrant grantextraParams - extra parametersClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, AccessTokenGrant grant, Map<String,String> extraParams) throws OAuthServiceException
accessTokenService - the AccessToken clientgrant - AccessTokenGrant grantextraParams - extra parametersClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant, Map<String,String> extraParams, boolean setAuthorizationHeader) throws OAuthServiceException
accessTokenService - the AccessToken clientconsumer - OAuthClientUtils.Consumer representing the registered client.grant - AccessTokenGrant grantextraParams - extra parameterssetAuthorizationHeader - if set to true then HTTP Basic scheme
will be used to pass client id and secret, otherwise they will
be passed in the form payloadClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, ClientAccessToken at)
public static ClientAccessToken refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, ClientAccessToken at)
public static ClientAccessToken refreshAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, ClientAccessToken at, String scope, boolean setAuthorizationHeader) throws OAuthServiceException
OAuthServiceExceptionpublic static ClientAccessToken getAccessToken(org.apache.cxf.jaxrs.client.WebClient accessTokenService, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant, Map<String,String> extraParams, String defaultTokenType, boolean setAuthorizationHeader) throws OAuthServiceException
accessTokenService - the AccessToken clientconsumer - OAuthClientUtils.Consumer representing the registered client.grant - AccessTokenGrant grantextraParams - extra parametersdefaultTokenType - default expected token type - some early
well-known OAuth2 services do not return a required token_type parametersetAuthorizationHeader - if set to true then HTTP Basic scheme
will be used to pass client id and secret, otherwise they will
be passed in the form payloadClientAccessToken access tokenOAuthServiceExceptionpublic static ClientAccessToken fromMapToClientToken(Map<String,String> map)
public static ClientAccessToken fromMapToClientToken(Map<String,String> map, String defaultTokenType)
public static String createAuthorizationHeader(ClientAccessToken accessToken) throws OAuthServiceException
accessToken - the access tokenOAuthServiceExceptionpublic static String createAuthorizationHeader(ClientAccessToken accessToken, HttpRequestProperties httpProps) throws OAuthServiceException
accessToken - the access tokenhttpProps - http request properties, can be null for Bearer tokensOAuthServiceExceptionpublic static void setAuthorizationHeader(org.apache.cxf.jaxrs.client.WebClient wc,
ClientAccessToken accessToken)
public static void setAuthorizationHeader(org.apache.cxf.jaxrs.client.WebClient wc,
ClientAccessToken accessToken,
String httpVerb)
Apache CXF