public class RequestSigning extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_ALLOWABLE_TIME_DELTA |
static java.lang.String |
PARAM_SIGNATURE |
static java.lang.String |
PARAM_TIMESTAMP |
| Constructor and Description |
|---|
RequestSigning() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
clean(java.lang.String str) |
static void |
constructSignatureForRequestParameters(java.util.List<org.apache.http.NameValuePair> params,
java.lang.String secretKey)
Signs a set of request parameters.
|
protected static void |
constructSignatureForRequestParameters(java.util.List<org.apache.http.NameValuePair> params,
java.lang.String secretKey,
long currentTimeSeconds)
Signs a set of request parameters.
|
static boolean |
verifyRequestSignature(javax.servlet.http.HttpServletRequest request,
java.lang.String secretKey)
Verifies the signature in an HttpServletRequest.
|
protected static boolean |
verifyRequestSignature(javax.servlet.http.HttpServletRequest request,
java.lang.String secretKey,
long currentTimeMillis)
Verifies the signature in an HttpServletRequest.
|
public static final int MAX_ALLOWABLE_TIME_DELTA
public static final java.lang.String PARAM_SIGNATURE
public static final java.lang.String PARAM_TIMESTAMP
public RequestSigning()
public static void constructSignatureForRequestParameters(java.util.List<org.apache.http.NameValuePair> params, java.lang.String secretKey)
Generates additional parameters to represent the timestamp and generated signature. Uses the supplied pre-shared secret key to generate the signature.
params - List of NameValuePair instances containing the query parameters for the request that is to be signedsecretKey - the pre-shared secret key held by the clientprotected static void constructSignatureForRequestParameters(java.util.List<org.apache.http.NameValuePair> params, java.lang.String secretKey, long currentTimeSeconds)
Generates additional parameters to represent the timestamp and generated signature. Uses the supplied pre-shared secret key to generate the signature.
params - List of NameValuePair instances containing the query parameters for the request that is to be signedsecretKey - the pre-shared secret key held by the clientcurrentTimeSeconds - the current time in seconds since 1970-01-01public static boolean verifyRequestSignature(javax.servlet.http.HttpServletRequest request, java.lang.String secretKey)
request - The HttpServletRequest to be verifiedsecretKey - The pre-shared secret key used by the sender of the request to create the signatureprotected static boolean verifyRequestSignature(javax.servlet.http.HttpServletRequest request, java.lang.String secretKey, long currentTimeMillis)
request - The HttpServletRequest to be verifiedsecretKey - The pre-shared secret key used by the sender of the request to create the signaturecurrentTimeMillis - The current time, in milliseconds.public static java.lang.String clean(java.lang.String str)