protected function validatePayload($nonce, \stdClass $payload, $now = null, $leeway = 0)
    {
        $now = $now ?: time();
        $violations = [];

        if ($payload->exp + $leeway <= $now) {
            $exp = date(\DateTime::ISO8601, $payload->exp);
            $violations[] = new \InvalidArgumentException('Token already expired at '.$exp);
        }

        if ($now + $leeway < $payload->iat) {
            $issuedAt = date(\DateTime::ISO8601, $payload->iat);
            $violations[] = new \InvalidArgumentException('Cannot handle token prior to '.$issuedAt);
        }

        if ($payload->nonce !== $nonce) {
            $violations[] = new \InvalidArgumentException('Nonce mismatch');
        }

        return $violations;
    }
protected function validatePayload($nonce, \stdClass $payload, $now = null, $leeway = 0)
    {
        $now = $now ?: time();
        $violations = [];

        if ($payload->exp + $leeway <= $now) {
            $exp = date(\DateTime::ISO8601, $payload->exp);
            $violations[] = new \InvalidArgumentException('Token already expired at '.$exp);
        }

        if ($now + $leeway < $payload->iat) {
            $issuedAt = date(\DateTime::ISO8601, $payload->iat);
            $violations[] = new \InvalidArgumentException('Cannot handle token prior to '.$issuedAt);
        }

        if ($payload->nonce !== $nonce) {
            $violations[] = new \InvalidArgumentException('Nonce mismatch');
        }

        return $violations;
    }
protected function validatePayload ( $ nonce , \ stdClass $ payload , $ now = null , $ leeway = 0 ) { $ now = $ now ? : time ( ) ; $ violations = [ ] ; if ( $ payload -> exp + $ leeway <= $ now ) { $ exp = date ( \ DateTime :: ISO8601 , $ payload -> exp ) ; $ violations [ ] = new \ InvalidArgumentException ( 'Token already expired at ' . $ exp ) ; } if ( $ now + $ leeway < $ payload -> iat ) { $ issuedAt = date ( \ DateTime :: ISO8601 , $ payload -> iat ) ; $ violations [ ] = new \ InvalidArgumentException ( 'Cannot handle token prior to ' . $ issuedAt ) ; } if ( $ payload -> nonce !== $ nonce ) { $ violations [ ] = new \ InvalidArgumentException ( 'Nonce mismatch' ) ; } return $ violations ; }
Validate the payload of a CSRF token.

@param string    $nonce   Value used to associate a client session
@param \stdClass $payload The token payload to validate
@param int       $now     The current time, defaults to `time()`
@param int       $leeway  The leeway in seconds

@return InvalidArgumentException[] Constraint violations; if $payload is valid, an empty array
Validate the payload of a CSRF token .