public class SimpleOAuthValidator extends Object implements OAuthValidator
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TIMESTAMP_WINDOW
The default window for timestamps is 5 minutes.
|
protected double |
maxVersion |
protected double |
minVersion |
static Set<String> |
SINGLE_PARAMETERS
Names of parameters that may not appear twice in a valid message.
|
protected long |
timestampWindow |
| Constructor and Description |
|---|
SimpleOAuthValidator()
Construct a validator that rejects messages more than five minutes out
of date, or with a OAuth version other than 1.0, or with an invalid
signature.
|
SimpleOAuthValidator(long timestampWindowMsec,
double maxVersion)
Public constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkSingleParameters(OAuthMessage message)
Throw an exception if any SINGLE_PARAMETERS occur repeatedly.
|
protected long |
currentTimeMsec() |
void |
validateMessage(OAuthMessage message,
OAuthAccessor accessor) |
protected void |
validateSignature(OAuthMessage message,
OAuthAccessor accessor) |
protected void |
validateTimestampAndNonce(OAuthMessage message)
This implementation doesn't check the nonce value.
|
protected void |
validateVersion(OAuthMessage message) |
public static final long DEFAULT_TIMESTAMP_WINDOW
public static final Set<String> SINGLE_PARAMETERS
protected final double minVersion
protected final double maxVersion
protected final long timestampWindow
public SimpleOAuthValidator()
public SimpleOAuthValidator(long timestampWindowMsec,
double maxVersion)
timestampWindowSec - specifies, in seconds, the windows (into the past and
into the future) in which we'll accept timestamps.maxVersion - the maximum acceptable oauth_versionpublic void validateMessage(OAuthMessage message, OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException
validateMessage in interface OAuthValidatorURISyntaxExceptionOAuthException - TODOOAuthProblemException - the message is invalid.
The implementation should throw exceptions that conform to the OAuth
Problem Reporting extension.IOException - TODOprotected void checkSingleParameters(OAuthMessage message) throws IOException, OAuthException
IOExceptionOAuthExceptionprotected void validateVersion(OAuthMessage message) throws OAuthException, IOException
OAuthExceptionIOExceptionprotected void validateTimestampAndNonce(OAuthMessage message) throws IOException, OAuthProblemException
IOExceptionOAuthProblemExceptionprotected void validateSignature(OAuthMessage message, OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException
protected long currentTimeMsec()
Copyright 2015- Charles R. Severance and licensed CC-BY Attribution 4.0