Resolve #2957273 "Jwt log in"
3 unresolved threads
3 unresolved threads
Related to #2957273
Merge request reports
Activity
added 1 commit
- 91f34599 - Refactor for elegance. No longer interacting with all responses
1 jwt_in_login_response: true 37 $this->routeBuilder = $routeBuilder; 38 } 39 40 /** 41 * {@inheritdoc} 42 */ 43 public function onAlterRoutes(RouteBuildEvent $event) { 44 // Disabled by configuration. 45 if (!$this->configFactory->get('jwt_auth_issuer.config')->get('jwt_in_login_response')) { 46 return; 47 } 48 49 $collection = $event->getRouteCollection(); 50 $route = $collection->get('user.login.http'); 51 if ($route) { 52 $route->addDefaults(['_controller' => '\Drupal\jwt_auth_issuer\Controller\JwtAuthIssuerLoginController::login']); The route we're decorating is also specific to JSON - it actually get more added in \Drupal\serialization\EventSubscriber\UserRouteAlterSubscriber... I think we should change the code to work for all serializers - and open a core issue to add a way to alter what's returned without having to re-serialize.
added 1 commit
- 9a5fa860 - Add test coverage for different serialization formats
78 */ 79 public function login(Request $request): Response { 80 $response = $this->userController->login($request); 81 82 // Ensure not error response. 83 if ($response->getStatusCode() !== 200) { 84 return $response; 85 } 86 87 // Note that the call to UserAuthenticationController::login() will have 88 // already validated that the format is supported. 89 $format = $request->getRequestFormat(); 90 91 // Decode and add JWT token. 92 if ($content = $response->getContent()) { 93 if ($decoded = $this->serializer->decode($content, $format)) { added 2 commits
added 2 commits
Please register or sign in to reply