public class TimestampSpeechletRequestVerifier extends Object implements SpeechletRequestVerifier
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 |
|---|
TimestampSpeechletRequestVerifier(long tolerance,
TimeUnit unit)
Constructs a new timestamp verifier with the provided tolerance (in the provided units).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
verify(SpeechletRequest request,
Session session)
Returns true if the provided date is inclusively within the verifier tolerance, either in the
past or future, of the current system time.
|
public TimestampSpeechletRequestVerifier(long tolerance,
TimeUnit unit)
tolerance - the tolerance of this verifierunit - the time unit of the tolerance parameterpublic boolean verify(SpeechletRequest request, Session session)
SpeechletRequest or SpeechletRequest.getTimestamp() is null.verify in interface SpeechletRequestVerifierrequest - SpeechletRequest to validatesession - Session context within which to validate the callCopyright © 2016. All rights reserved.