|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cxf.rs.security.oauth2.client.OAuthClientUtils
public final class OAuthClientUtils
The utility class for simplifying working with OAuth servers
Nested Class Summary | |
---|---|
static class |
OAuthClientUtils.Consumer
Simple consumer representation |
Method Summary | |
---|---|
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(WebClient accessTokenService,
AccessTokenGrant grant)
Obtains the access token from OAuth AccessToken Service using the initialized web client |
static ClientAccessToken |
getAccessToken(WebClient accessTokenService,
AccessTokenGrant grant,
Map<String,String> extraParams)
Obtains the access token from OAuth AccessToken Service using the initialized web client |
static ClientAccessToken |
getAccessToken(WebClient accessTokenService,
OAuthClientUtils.Consumer consumer,
AccessTokenGrant grant)
Obtains the access token from OAuth AccessToken Service using the initialized web client |
static ClientAccessToken |
getAccessToken(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(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(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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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 request
public 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 scope
public static ClientAccessToken getAccessToken(WebClient accessTokenService, OAuthClientUtils.Consumer consumer, AccessTokenGrant grant) throws OAuthServiceException
accessTokenService
- the AccessToken clientconsumer
- OAuthClientUtils.Consumer
representing the registered clientgrant
- AccessTokenGrant
grant
ClientAccessToken
access token
OAuthServiceException
public 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 payload
ClientAccessToken
access token
OAuthServiceException
public static ClientAccessToken getAccessToken(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 payload
ClientAccessToken
access token
OAuthServiceException
public static ClientAccessToken getAccessToken(WebClient accessTokenService, AccessTokenGrant grant) throws OAuthServiceException
accessTokenService
- the AccessToken clientgrant
- AccessTokenGrant
grantextraParams
- extra parameters
ClientAccessToken
access token
OAuthServiceException
public static ClientAccessToken getAccessToken(WebClient accessTokenService, AccessTokenGrant grant, Map<String,String> extraParams) throws OAuthServiceException
accessTokenService
- the AccessToken clientgrant
- AccessTokenGrant
grantextraParams
- extra parameters
ClientAccessToken
access token
OAuthServiceException
public static ClientAccessToken getAccessToken(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 payload
ClientAccessToken
access token
OAuthServiceException
public static ClientAccessToken getAccessToken(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 payload
ClientAccessToken
access token
OAuthServiceException
public 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 token
OAuthServiceException
public static String createAuthorizationHeader(ClientAccessToken accessToken, HttpRequestProperties httpProps) throws OAuthServiceException
accessToken
- the access tokenhttpProps
- http request properties, can be null for Bearer tokens
OAuthServiceException
|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |