src/Security/EventListener/Token/Identity/TypeListener.php
public function created(JWTCreatedEvent $event)
    {
        $data = $event->getData();
        $user = $event->getUser();

        // @todo Standardize interface between app user entity and security user model
        if ($user instanceof User) {
            $this->accessor->setValue($data, $this->property, $user->getIdentity()->getType());
        } else {
            $this->accessor->setValue($data, $this->property, $user->getIdentity());
        }

        $event->setData($data);
    }
public function created(JWTCreatedEvent $event)
    {
        $data = $event->getData();
        $user = $event->getUser();

        // @todo Standardize interface between app user entity and security user model
        if ($user instanceof User) {
            $this->accessor->setValue($data, $this->property, $user->getIdentity()->getType());
        } else {
            $this->accessor->setValue($data, $this->property, $user->getIdentity());
        }

        $event->setData($data);
    }
public function created ( JWTCreatedEvent $ event ) { $ data = $ event -> getData ( ) ; $ user = $ event -> getUser ( ) ; // @todo Standardize interface between app user entity and security user model if ( $ user instanceof User ) { $ this -> accessor -> setValue ( $ data , $ this -> property , $ user -> getIdentity ( ) -> getType ( ) ) ; } else { $ this -> accessor -> setValue ( $ data , $ this -> property , $ user -> getIdentity ( ) ) ; } $ event -> setData ( $ data ) ; }
Add the identity type to the token

@param \Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent $event
@throws \Ds\Component\Security\Exception\InvalidUserTypeException
Add the identity type to the token