M
M
MasterCopipaster2022-02-20 10:49:09
symfony
MasterCopipaster, 2022-02-20 10:49:09

How to do basic authentication on a specific route in symfony 5.2.2?

Tell me how to quickly and easily make basic authentication on a specific route?

Example:

class PostsController extends AbstractController
{


    /**
     * @Route("/master/posts/new", name="new-posts", methods={"GET","HEAD"})
     * @return mixed
     */
    public function index()
    {


        return $this->render('post/master/new.html.twig', [
            'form' => new PostType()
        ]);
    }
}


Is there a quick way to put basic on this route?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2022-02-21
@MasterCopipaster

https://symfony.com/doc/current/security.html#the-...
https://symfony.com/doc/current/security.html#http...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question