if (!
hash_equals($hash,
$this->
computeSignatureHash($user,
$expires))) { throw new InvalidSignatureException('Invalid or expired signature.'
);
} if ($this->expiredSignaturesStorage &&
$this->maxUses
) { if ($this->expiredSignaturesStorage->
countUsages($hash) >=
$this->maxUses
) { throw new ExpiredSignatureException(sprintf('Signature can only be used "%d" times.',
$this->maxUses
));
} $this->expiredSignaturesStorage->
incrementUsages($hash);
} } /**
* Computes the secure hash for the provided user and expire time.
*
* @param int $expires The expiry time as a unix timestamp
*/
public function computeSignatureHash(UserInterface
$user, int
$expires): string
{ $userIdentifier =
$user->
getUserIdentifier();