org.jboss.resteasy.auth.oauth
Class OAuthUtils

java.lang.Object
  extended by org.jboss.resteasy.auth.oauth.OAuthUtils

public class OAuthUtils
extends java.lang.Object


Field Summary
static java.lang.String AUTHENTICATE_HEADER
          HTTP WWW-Authenticate header
static java.lang.String AUTHORIZATION_HEADER
          HTTP Authorization header
static java.lang.String OAUTH_CALLBACK_CONFIRMED_PARAM
          OAuth Callback Confirmed parameter
static java.lang.String OAUTH_VERIFIER_PARAM
          OAuth Verifier parameter
 
Constructor Summary
OAuthUtils()
           
 
Method Summary
static java.lang.String encodeForOAuth(java.lang.String value)
          Encodes the given value for use in an OAuth parameter
static int getHttpCode(net.oauth.OAuthProblemException x)
          Finds the HTTP status code from the given exception
static OAuthProvider getOAuthProvider(javax.servlet.ServletContext context)
          Loads the OAuthProvider as specified in the Servlet Context parameters, and caches it in the Servlet Context attributes for reuse.
static OAuthValidator getValidator(javax.servlet.ServletContext context, OAuthProvider provider)
          Creates an OAuthValidator, and caches it in the Servlet Context attributes for reuse.
static void makeErrorResponse(javax.servlet.http.HttpServletResponse resp, java.lang.String message, int httpCode, OAuthProvider provider)
          Sends an error to the OAuth Consumer
static long parseTimestamp(java.lang.String timestampString)
          Parse an OAuth timestamp
static net.oauth.OAuthMessage readMessage(javax.servlet.http.HttpServletRequest req)
          Reads an OAuthMessage from an HTTP Servlet Request.
static void sendValues(javax.servlet.http.HttpServletResponse resp, java.lang.String... params)
          Sends a list of OAuth parameters in the body of the given Http Servlet Response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHORIZATION_HEADER

public static final java.lang.String AUTHORIZATION_HEADER
HTTP Authorization header

See Also:
Constant Field Values

AUTHENTICATE_HEADER

public static final java.lang.String AUTHENTICATE_HEADER
HTTP WWW-Authenticate header

See Also:
Constant Field Values

OAUTH_VERIFIER_PARAM

public static final java.lang.String OAUTH_VERIFIER_PARAM
OAuth Verifier parameter

See Also:
Constant Field Values

OAUTH_CALLBACK_CONFIRMED_PARAM

public static final java.lang.String OAUTH_CALLBACK_CONFIRMED_PARAM
OAuth Callback Confirmed parameter

See Also:
Constant Field Values
Constructor Detail

OAuthUtils

public OAuthUtils()
Method Detail

encodeForOAuth

public static java.lang.String encodeForOAuth(java.lang.String value)
Encodes the given value for use in an OAuth parameter


sendValues

public static void sendValues(javax.servlet.http.HttpServletResponse resp,
                              java.lang.String... params)
                       throws java.io.IOException
Sends a list of OAuth parameters in the body of the given Http Servlet Response

Parameters:
params - a list of parameters
Throws:
java.io.IOException

readMessage

public static net.oauth.OAuthMessage readMessage(javax.servlet.http.HttpServletRequest req)
Reads an OAuthMessage from an HTTP Servlet Request. Uses the Authorization header, GET and POST parameters.


makeErrorResponse

public static void makeErrorResponse(javax.servlet.http.HttpServletResponse resp,
                                     java.lang.String message,
                                     int httpCode,
                                     OAuthProvider provider)
                              throws java.io.IOException
Sends an error to the OAuth Consumer

Throws:
java.io.IOException

parseTimestamp

public static long parseTimestamp(java.lang.String timestampString)
                           throws OAuthException
Parse an OAuth timestamp

Throws:
OAuthException

getHttpCode

public static int getHttpCode(net.oauth.OAuthProblemException x)
Finds the HTTP status code from the given exception


getOAuthProvider

public static OAuthProvider getOAuthProvider(javax.servlet.ServletContext context)
                                      throws javax.servlet.ServletException
Loads the OAuthProvider as specified in the Servlet Context parameters, and caches it in the Servlet Context attributes for reuse.

Throws:
javax.servlet.ServletException

getValidator

public static OAuthValidator getValidator(javax.servlet.ServletContext context,
                                          OAuthProvider provider)
Creates an OAuthValidator, and caches it in the Servlet Context attributes for reuse.



Copyright © 2009. All Rights Reserved.