Package net.oauth
Class SimpleOAuthValidator
- java.lang.Object
-
- net.oauth.SimpleOAuthValidator
-
- All Implemented Interfaces:
OAuthValidator
public class SimpleOAuthValidator extends Object implements OAuthValidator
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_MAX_TIMESTAMP_AGE
static long
DEFAULT_TIMESTAMP_WINDOW
protected long
maxTimestampAgeMsec
protected double
maxVersion
protected double
minVersion
static Set<String>
SINGLE_PARAMETERS
-
Constructor Summary
Constructors Constructor Description SimpleOAuthValidator()
SimpleOAuthValidator(long maxTimestampAgeMsec, double maxVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkSingleParameters(OAuthMessage message)
protected long
currentTimeMsec()
Date
releaseGarbage()
void
validateMessage(OAuthMessage message, OAuthAccessor accessor)
Check that the given message from the given accessor is valid.protected Date
validateNonce(OAuthMessage message, long timestamp, long currentTimeMsec)
protected void
validateSignature(OAuthMessage message, OAuthAccessor accessor)
protected void
validateTimestamp(OAuthMessage message, long timestamp, long currentTimeMsec)
protected void
validateTimestampAndNonce(OAuthMessage message)
protected void
validateVersion(OAuthMessage message)
-
-
-
Field Detail
-
DEFAULT_MAX_TIMESTAMP_AGE
public static final long DEFAULT_MAX_TIMESTAMP_AGE
- See Also:
- Constant Field Values
-
DEFAULT_TIMESTAMP_WINDOW
public static final long DEFAULT_TIMESTAMP_WINDOW
- See Also:
- Constant Field Values
-
maxTimestampAgeMsec
protected final long maxTimestampAgeMsec
-
maxVersion
protected final double maxVersion
-
minVersion
protected final double minVersion
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkSingleParameters
protected void checkSingleParameters(OAuthMessage message) throws IOException, OAuthException
- Throws:
IOException
OAuthException
-
currentTimeMsec
protected long currentTimeMsec()
-
releaseGarbage
public Date releaseGarbage()
-
validateMessage
public void validateMessage(OAuthMessage message, OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException
Description copied from interface:OAuthValidator
Check that the given message from the given accessor is valid.- Specified by:
validateMessage
in interfaceOAuthValidator
- Throws:
OAuthException
- the message doesn't conform to OAuth. The exception contains information that conforms to the OAuth Problem Reporting extension.IOException
- the message couldn't be read.URISyntaxException
- the message URL is invalid.
-
validateNonce
protected Date validateNonce(OAuthMessage message, long timestamp, long currentTimeMsec) throws IOException, OAuthProblemException
- Throws:
IOException
OAuthProblemException
-
validateSignature
protected void validateSignature(OAuthMessage message, OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException
-
validateTimestamp
protected void validateTimestamp(OAuthMessage message, long timestamp, long currentTimeMsec) throws IOException, OAuthProblemException
- Throws:
IOException
OAuthProblemException
-
validateTimestampAndNonce
protected void validateTimestampAndNonce(OAuthMessage message) throws IOException, OAuthProblemException
- Throws:
IOException
OAuthProblemException
-
validateVersion
protected void validateVersion(OAuthMessage message) throws OAuthException, IOException
- Throws:
OAuthException
IOException
-
-