src/Controller/PublicConfigurationController.php line 46

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Manager\ConfigurationManagerInterface;
  4. use Psr\Log\LoggerInterface;
  5. use Swagger\Annotations as SWG;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\JsonResponse;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class PublicConfigurationController extends AbstractController
  11. {
  12.     private LoggerInterface $logger;
  13.     public function __construct(LoggerInterface $logger)
  14.     {
  15.         $this->logger $logger;
  16.     }
  17.     /**
  18.      * @Route("/api/public/realms", name="get_realm", methods={"Get"})
  19.      * @SWG\Get (
  20.      *     path="/api/public/realms",
  21.      *     tags={"Public"},
  22.      *     summary="Gets realm according to domain name",
  23.      *     @SWG\Parameter(
  24.      *         name="domainName",
  25.      *         in="query",
  26.      *         description="Domain name or ""hostname"" (e.g. front.localhost)",
  27.      *         required=false,
  28.      *         default="default",
  29.      *         type="string"
  30.      *     ),
  31.      *     @SWG\Response(
  32.      *         response=200,
  33.      *         description="OK."
  34.      *     ),
  35.      *     @SWG\Response(
  36.      *         response=409,
  37.      *         description="Conflict."
  38.      *     )
  39.      * )
  40.      */
  41.     public function getRealm(
  42.         ConfigurationManagerInterface $configurationManager,
  43.         Request $request
  44.     ): JsonResponse {
  45.         return $this->json($configurationManager->getRealm($request->get('domainName')));
  46.     }
  47. }