src/Security/EventListener/Token/ModifierListener.php
public function decoded(JWTDecodedEvent $event)
    {
        $payload = $event->getPayload();

        // Make property accessor paths compatible by converting payload to recursive associative array
        $payload = json_decode(json_encode($payload), true);

        foreach ($this->removed as $property) {
            if (array_key_exists($property, $payload)) {
                $event->markAsInvalid();
                break;
            }
        }
    }
public function decoded(JWTDecodedEvent $event)
    {
        $payload = $event->getPayload();

        // Make property accessor paths compatible by converting payload to recursive associative array
        $payload = json_decode(json_encode($payload), true);

        foreach ($this->removed as $property) {
            if (array_key_exists($property, $payload)) {
                $event->markAsInvalid();
                break;
            }
        }
    }
Mark the token as invalid if the token is not modified

@param \Lexik\Bundle\JWTAuthenticationBundle\Event\JWTDecodedEvent $event