Apache CXF API

org.apache.cxf.rs.security.oauth.client
Class OAuthClientUtils

java.lang.Object
  extended by org.apache.cxf.rs.security.oauth.client.OAuthClientUtils

public final class OAuthClientUtils
extends Object

The utility class for simplifying making OAuth request and access token requests as well as for creating Authorization OAuth headers


Nested Class Summary
static class OAuthClientUtils.Consumer
          Simple consumer representation
static class OAuthClientUtils.Token
          Simple token representation
 
Method Summary
static String createAuthorizationHeader(OAuthClientUtils.Consumer consumer)
          Creates OAuth Authorization header containing consumer key and secret values only
static String createAuthorizationHeader(OAuthClientUtils.Consumer consumer, OAuthClientUtils.Token accessToken, String method, String requestURI)
          Creates OAuth Authorization header
static OAuthClientUtils.Token getAccessToken(WebClient accessTokenService, OAuthClientUtils.Consumer consumer, OAuthClientUtils.Token requestToken, String verifier)
          Returns a simple representation of the Access token
static URI getAuthorizationURI(String authorizationServiceURI, String requestToken)
          Returns URI of the authorization service with the query parameter containing the request token key
static OAuthClientUtils.Token getRequestToken(WebClient requestTokenService, OAuthClientUtils.Consumer consumer, URI callback, Map<String,String> extraParams)
          Returns a simple representation of the Request token
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAuthorizationURI

public static URI getAuthorizationURI(String authorizationServiceURI,
                                      String requestToken)
Returns URI of the authorization service with the query parameter containing the request token key

Parameters:
authorizationServiceURI - the service URI
requestToken - the request token key
Returns:

getRequestToken

public static OAuthClientUtils.Token getRequestToken(WebClient requestTokenService,
                                                     OAuthClientUtils.Consumer consumer,
                                                     URI callback,
                                                     Map<String,String> extraParams)
                                              throws OAuthServiceException
Returns a simple representation of the Request token

Parameters:
requestTokenService - initialized RequestToken service client
consumer - Consumer bean containing the consumer key and secret
callback - the callback URI where the request token verifier will be returned
extraParams - additional parameters such as state, scope, etc
Returns:
the token
Throws:
OAuthServiceException

getAccessToken

public static OAuthClientUtils.Token getAccessToken(WebClient accessTokenService,
                                                    OAuthClientUtils.Consumer consumer,
                                                    OAuthClientUtils.Token requestToken,
                                                    String verifier)
                                             throws OAuthServiceException
Returns a simple representation of the Access token

Parameters:
accessTokenService - initialized AccessToken service client
consumer - Consumer bean containing the consumer key and secret
verifier - the verifier/authorization key
Returns:
the token
Throws:
OAuthServiceException

createAuthorizationHeader

public static String createAuthorizationHeader(OAuthClientUtils.Consumer consumer,
                                               OAuthClientUtils.Token accessToken,
                                               String method,
                                               String requestURI)
Creates OAuth Authorization header

Parameters:
consumer - Consumer bean containing the consumer key and secret
token - Access token representation
method - HTTP method
requestURI - request URI
Returns:
the header value

createAuthorizationHeader

public static String createAuthorizationHeader(OAuthClientUtils.Consumer consumer)
Creates OAuth Authorization header containing consumer key and secret values only

Parameters:
consumer - Consumer bean containing the consumer key and secret
Returns:
the header value

Apache CXF API

Apache CXF