Answer the question
In order to leave comments, you need to log in
New authentication system no longer redirects?
I am moving the project to the latest version, I read that now there is a new authentication system. I have this configuration:
<?php
use App\Entity\User;
use App\Security\LoginAuthenticator;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
use Symfony\Config\SecurityConfig;
return static function (SecurityConfig $security) {
$security->enableAuthenticatorManager(true);
$security->provider('app_user_provider')
->entity()
->class(User::class)
->property('login');
$security->passwordHasher(User::class)
->algorithm('bcrypt')
->cost(12);
$security->firewall('dev')
->pattern('^/(_(profiler|wdt)|css|images|js)/')
->security(false);
$security->firewall('main')
->lazy(true)
->customAuthenticators([LoginAuthenticator::class])
->logout()
->path('logout')
->target('login');
$security->accessControl()->path('^/login')->roles([AuthenticatedVoter::PUBLIC_ACCESS]);
$security->accessControl()->path('^/')->roles(['ROLE_USER']);
};
Full authentication is required to access this resource.
Answer the question
In order to leave comments, you need to log in
In general, I’m reading a book, I see a fig, I didn’t look well at what’s in FirewallConfig
In the firewall, add entryPoint
a class fromAuthenticationEntryPointInterface
$security->firewall('main')
->lazy(true)
->customAuthenticators([LoginAuthenticator::class])
->entryPoint(AuthenticationEntryPoint::class)
->logout()
->path('logout')
->target('login');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question