public function validate()
    {
        if (time() > $this->getExpiration()) {
            throw new exceptions\TokenExpiredException('Token is expired.');
        }
        if ($this->getHash() != $this->generateHash()) {
            throw new exceptions\InvalidHashException('Invalid token hash.');
        }
    }