# AuthenticationSubscriber

Implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Subscriber to JWT authentication

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Symfony\Component\HttpFoundation\RequestStack $stack, \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $storage, \Symfony\Component\Security\Core\Role\RoleHierarchyInterface $hierarchy, \Doctrine\ORM\EntityManagerInterface $em, \Psr\Log\LoggerInterface $securityLogger)

### Arguments

#### $stack

`\Symfony\Component\HttpFoundation\RequestStack`

#### $storage

`\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface`

#### $hierarchy

`\Symfony\Component\Security\Core\Role\RoleHierarchyInterface`

#### $em

`\Doctrine\ORM\EntityManagerInterface`

#### $securityLogger

`\Psr\Log\LoggerInterface`

## getSubscribedEvents

    getSubscribedEvents()

static

inheritDoc |

## onAuthenticationSuccess

    onAuthenticationSuccess(\Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationSuccessEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationSuccessEvent`

## onJWTAuthenticated

    onJWTAuthenticated(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTAuthenticatedEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTAuthenticatedEvent`

## onJWTCreated

    onJWTCreated(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent`

## onJWTDecoded

    onJWTDecoded(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTDecodedEvent $event)

todo | Solve IP address checking as its problematic

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTDecodedEvent`

## onJWTExpired

    onJWTExpired(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTExpiredEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTExpiredEvent`

## onJWTInvalid

    onJWTInvalid(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTInvalidEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTInvalidEvent`

## onJWTNotFound

    onJWTNotFound(\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTNotFoundEvent $event)

### Arguments

#### $event

`\Lexik\Bundle\JWTAuthenticationBundle\Event\JWTNotFoundEvent`

## Creates and sets the bearer cookie for cookie based authentication

    setCookie(string $token)

### Arguments

#### $token

`string`

## Unsets the bearer cookie in case of failure

    unsetCookie()

### Constants

## TEST_IP

    TEST_IP

## TEST_AGENT

    TEST_AGENT

### Properties

## request

    request : \Symfony\Component\HttpFoundation\Request

var |

### Type(s)

`\Symfony\Component\HttpFoundation\Request`

## storage

    storage : \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface

var |

### Type(s)

`\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface`

## hierarchy

    hierarchy : \Symfony\Component\Security\Core\Role\RoleHierarchyInterface

var |

### Type(s)

`\Symfony\Component\Security\Core\Role\RoleHierarchyInterface`

## em

    em : \Doctrine\ORM\EntityManagerInterface

var |

### Type(s)

`\Doctrine\ORM\EntityManagerInterface`

## logger

    logger : \Psr\Log\LoggerInterface

var |

### Type(s)

`\Psr\Log\LoggerInterface`