public class SkillRequestTimestampVerifier extends Object implements SkillServletVerifier
Every request sent by Alexa includes a timestamp. This information is part of the signed portion of the request, so it cannot be changed without also invalidating the request signature. Using this timestamp to verify the freshness of the request before responding protects the client's service from attackers attempting a "replay" attack in which they acquire a properly signed request and then repeatedly resend it to disrupt your service.
| Constructor and Description |
|---|
SkillRequestTimestampVerifier(long toleranceInMilliseconds)
Constructs a new timestamp verifier with the provided tolerance milliseconds.
|
| Modifier and Type | Method and Description |
|---|---|
void |
verify(javax.servlet.http.HttpServletRequest servletRequest,
byte[] serializedRequestEnvelope,
com.amazon.ask.model.RequestEnvelope deserializedRequestEnvelope)
Validates if the provided date is inclusively within the verifier tolerance, either in the
past or future, of the current system time.
|
public SkillRequestTimestampVerifier(long toleranceInMilliseconds)
toleranceInMilliseconds - the tolerance of this verifier, in milliseconds. must be non-negative and less than
.public void verify(javax.servlet.http.HttpServletRequest servletRequest,
byte[] serializedRequestEnvelope,
com.amazon.ask.model.RequestEnvelope deserializedRequestEnvelope)
SecurityException if the
tolerance is not in the expected range, or if the request is null or does not contain a timestamp value.
Verifies an incoming request.verify in interface SkillServletVerifierservletRequest - servlet requestserializedRequestEnvelope - the request envelope, in serialized formdeserializedRequestEnvelope - the request envelope, in deserialized formCopyright © Amazon.com, Inc. or its affiliates. All Rights Reserved.