src/Security/EventListener/Token/IpListener.php
public function decoded(JWTDecodedEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();
        $payload = $event->getPayload();

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

        if (!$this->accessor->isReadable($payload, $this->property)) {
            $event->markAsInvalid();
        } elseif ($this->validate && $this->accessor->getValue($payload, $this->property) !== $request->getClientIp()) {
            $event->markAsInvalid();
        }
    }
public function decoded(JWTDecodedEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();
        $payload = $event->getPayload();

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

        if (!$this->accessor->isReadable($payload, $this->property)) {
            $event->markAsInvalid();
        } elseif ($this->validate && $this->accessor->getValue($payload, $this->property) !== $request->getClientIp()) {
            $event->markAsInvalid();
        }
    }
public function decoded ( JWTDecodedEvent $ event ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ payload = $ event -> getPayload ( ) ; // Make property accessor paths compatible by converting payload to recursive associative array $ payload = json_decode ( json_encode ( $ payload ) , true ) ; if ( ! $ this -> accessor -> isReadable ( $ payload , $ this -> property ) ) { $ event -> markAsInvalid ( ) ; } elseif ( $ this -> validate && $ this -> accessor -> getValue ( $ payload , $ this -> property ) !== $ request -> getClientIp ( ) ) { $ event -> markAsInvalid ( ) ; } }
Mark the token as invalid if the ip is missing or is not valid

@param \Lexik\Bundle\JWTAuthenticationBundle\Event\JWTDecodedEvent $event
Mark the token as invalid if the ip is missing or is not valid