public class OAuthUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AUTHENTICATE_HEADER
HTTP WWW-Authenticate header
|
static String |
AUTHORIZATION_HEADER
HTTP Authorization header
|
static String |
OAUTH_CALLBACK_CONFIRMED_PARAM
OAuth Callback Confirmed parameter
|
static String |
OAUTH_VERIFIER_PARAM
OAuth Verifier parameter
|
Constructor and Description |
---|
OAuthUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
encodeForOAuth(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,
String message,
int httpCode,
OAuthProvider provider)
Sends an error to the OAuth Consumer
|
static long |
parseTimestamp(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,
String... params)
Sends a list of OAuth parameters in the body of the given Http Servlet Response
|
static void |
validateRequestWithAccessToken(javax.servlet.http.HttpServletRequest request,
net.oauth.OAuthMessage message,
OAuthToken accessToken,
OAuthValidator validator,
OAuthConsumer consumer) |
static void |
validateRequestWithoutAccessToken(javax.servlet.http.HttpServletRequest request,
net.oauth.OAuthMessage message,
OAuthValidator validator,
OAuthConsumer consumer)
Validates if a given request is a valid 2-leg oAuth request
|
static boolean |
validateUriScopes(String requestURI,
String[] scopes)
Validates if a current request URI matches URI provided by the consumer at the
registration time or during the request token validation request
|
public static final String AUTHORIZATION_HEADER
public static final String AUTHENTICATE_HEADER
public static final String OAUTH_VERIFIER_PARAM
public static final String OAUTH_CALLBACK_CONFIRMED_PARAM
public static String encodeForOAuth(String value)
public static void sendValues(javax.servlet.http.HttpServletResponse resp, String... params) throws IOException
params
- a list of IOException
public static net.oauth.OAuthMessage readMessage(javax.servlet.http.HttpServletRequest req)
public static void makeErrorResponse(javax.servlet.http.HttpServletResponse resp, String message, int httpCode, OAuthProvider provider) throws IOException
IOException
public static long parseTimestamp(String timestampString) throws OAuthException
OAuthException
public static int getHttpCode(net.oauth.OAuthProblemException x)
public static OAuthProvider getOAuthProvider(javax.servlet.ServletContext context) throws javax.servlet.ServletException
javax.servlet.ServletException
public static OAuthValidator getValidator(javax.servlet.ServletContext context, OAuthProvider provider)
public static void validateRequestWithAccessToken(javax.servlet.http.HttpServletRequest request, net.oauth.OAuthMessage message, OAuthToken accessToken, OAuthValidator validator, OAuthConsumer consumer) throws Exception
Exception
public static void validateRequestWithoutAccessToken(javax.servlet.http.HttpServletRequest request, net.oauth.OAuthMessage message, OAuthValidator validator, OAuthConsumer consumer) throws Exception
Exception
Copyright © 2014. All Rights Reserved.