I'm using Symfony 5
on my website. To authenticate users I'm using the LDAP Security bundle dedicated for that. It's works well
What I would like is to log in the database all client connections failed. With a custom LDAP Provider and User Checker, I'm able to catch :
What I would like is to catch invalid credential but I don't find where this exception is throw...
For you:
Thank you
You should get all this exceptions via the custom access denied handler. (parent exception)
namespace App\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
class AccessDeniedHandler implements AccessDeniedHandlerInterface
{
public function handle(Request $request, AccessDeniedException $accessDeniedException)
{
// ...
return new Response($content, 403);
}
}
-
# config/packages/security.yaml
firewalls:
# ...
main:
# ...
access_denied_handler: App\Security\AccessDeniedHandler
see https://symfony.com/doc/current/security/access_denied_handler.html for more info.