Interface for Request ID Lists.
A Request ID List is a running append-only list of already-seen request IDs.
Re-adding an already-seen request ID results in a DuplicateRequestIDException, interrupting request verification.
It can be used to ensure that no two requests with the same request ID are processed, e.g. to prevent replay attacks.
NB:
It's not recommended to use the interface methods directly.
Use the RequestVerifier helper class instead,
it has a withRequestIdList()
setter.
See “Request IDs” for more information and a usage example.
- Full interface name:
mle86\RequestAuthentication\RequestIdList\RequestIdList
- Interface file: src/RequestIdList/RequestIdList.php
- CacheRequestIdList class (takes a PSR-16 Cache instance)
-
contains (string $requestId): bool
Returns true if the Request ID is already contained in the list (put()
will fail), returns false if the Request ID is not yet known. -
put (string $requestId): void
Stores one Request ID in the list. This only works with Request IDs which are not yet contained within the list.
Returns if the ID has been added to the list successfully.
Throws a DuplicateRequestIDException if the Request ID has been seen previously.