Class OAuthRequest
java.lang.Object
org.eclipse.lyo.server.oauth.core.OAuthRequest
Validates that a request is authorized. The request must contain a valid
access token and pass
OAuthValidator tests. To change the validator
used, call OAuthConfiguration.setValidator(OAuthValidator).
Usage:
try {
OAuthRequest request = new OAuthRequest(httpRequest);
request.validate();
} catch (OAuthException e) {
// Request failed validation. Send an unauthorized response.
OAuthServlet.handleException(httpResponse, e, OAuthConfiguration.getInstance().getRealm());
}
- Author:
- Samuel Padgett
-
Constructor Summary
ConstructorsConstructorDescriptionOAuthRequest(HttpServletRequest request) OAuthRequest(HttpServletRequest request, String requestUrl) -
Method Summary
Modifier and TypeMethodDescriptionnet.oauth.OAuthAccessornet.oauth.OAuthMessagevoidsetHttpRequest(HttpServletRequest httpRequest) voidvalidate()Validates that the request is authorized and throws an OAuth exception if not.
-
Constructor Details
-
OAuthRequest
public OAuthRequest(HttpServletRequest request, String requestUrl) throws net.oauth.OAuthException, IOException - Parameters:
requestUrl- the official URL of the request; that is the URL a legitimate client would use to compute the digital signature. If this parameter is null, this method will try to reconstruct the URL from the HTTP request; which may be wrong in some cases.- Throws:
net.oauth.OAuthExceptionIOException
-
OAuthRequest
- Throws:
net.oauth.OAuthExceptionIOException
-
-
Method Details
-
getHttpRequest
-
setHttpRequest
-
getMessage
public net.oauth.OAuthMessage getMessage() -
getAccessor
public net.oauth.OAuthAccessor getAccessor() -
getConsumer
-
validate
Validates that the request is authorized and throws an OAuth exception if not. The request must contain a valid access token and passOAuthValidator.validateMessage(OAuthMessage, OAuthAccessor)checks using the validator set in theOAuthConfiguration.If the request fails validation, you can use
OAuthServlet.handleException(jakarta.servlet.http.HttpServletResponse, Exception, String)to send an unauthorized response.- Throws:
net.oauth.OAuthException- if the request fails validationIOExceptionServletException
-