| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function handleAuthenticationSuccess(UserInterface $user, $jwt = null): JWTAuthenticationSuccessResponse |
||
| 24 | { |
||
| 25 | if (null === $jwt) { |
||
| 26 | $jwt = $this->jwtManager->create($user); |
||
| 27 | } |
||
| 28 | |||
| 29 | $response = new JWTAuthenticationSuccessResponse($jwt); |
||
| 30 | |||
| 31 | $event = new AuthenticationSuccessEvent( |
||
| 32 | [ |
||
| 33 | 'result' => $jwt, |
||
| 34 | 'code' => Response::HTTP_OK, |
||
| 35 | ], |
||
| 36 | $user, |
||
| 37 | $response |
||
| 38 | ); |
||
| 39 | |||
| 40 | $this->dispatcher->dispatch($event); |
||
| 41 | |||
| 42 | return $response->setData($event->getData()); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |