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 longDEFAULT_MAX_TIMESTAMP_AGEstatic longDEFAULT_TIMESTAMP_WINDOWprotected longmaxTimestampAgeMsecprotected doublemaxVersionprotected doubleminVersionstatic 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 voidcheckSingleParameters(OAuthMessage message)protected longcurrentTimeMsec()DatereleaseGarbage()voidvalidateMessage(OAuthMessage message, OAuthAccessor accessor)Check that the given message from the given accessor is valid.protected DatevalidateNonce(OAuthMessage message, long timestamp, long currentTimeMsec)protected voidvalidateSignature(OAuthMessage message, OAuthAccessor accessor)protected voidvalidateTimestamp(OAuthMessage message, long timestamp, long currentTimeMsec)protected voidvalidateTimestampAndNonce(OAuthMessage message)protected voidvalidateVersion(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:
IOExceptionOAuthException
-
currentTimeMsec
protected long currentTimeMsec()
-
releaseGarbage
public Date releaseGarbage()
-
validateMessage
public void validateMessage(OAuthMessage message, OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException
Description copied from interface:OAuthValidatorCheck that the given message from the given accessor is valid.- Specified by:
validateMessagein 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:
IOExceptionOAuthProblemException
-
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:
IOExceptionOAuthProblemException
-
validateTimestampAndNonce
protected void validateTimestampAndNonce(OAuthMessage message) throws IOException, OAuthProblemException
- Throws:
IOExceptionOAuthProblemException
-
validateVersion
protected void validateVersion(OAuthMessage message) throws OAuthException, IOException
- Throws:
OAuthExceptionIOException
-
-