src/Controller/PublicConfigurationController.php line 47

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.      *
  20.      * @SWG\Get(
  21.      *     path="/api/public/realm",
  22.      *     tags={"Public"},
  23.      *     summary="Gets realm according to domain name",
  24.      *     @SWG\Parameter(
  25.      *         name="domainName",
  26.      *         in="query",
  27.      *         description="Domain name or ""hostname"" (e.g. front.localhost)",
  28.      *         required=false,
  29.      *         default="default",
  30.      *         type="string"
  31.      *     ),
  32.      *     @SWG\Response(
  33.      *         response=200,
  34.      *         description="OK."
  35.      *     ),
  36.      *     @SWG\Response(
  37.      *         response=409,
  38.      *         description="Conflict."
  39.      *     )
  40.      * )
  41.      */
  42.     public function getRealm(
  43.         ConfigurationManagerInterface $configurationManager,
  44.         Request $request
  45.     ): JsonResponse {
  46.         return $this->json($configurationManager->getRealm($request->get('domainName')));
  47.     }
  48. }