Symfony2 AccessDeniedException override hacking attempt record

The logic of the solution I'm developing implies that if an AccessDeniedException is thrown, it is a hack attempt.

It would be good, for logging purposes, to record these hacking attempts, such as which user (if authenticated) performs these attacks and the IP address when these attacks are performed. So I can block IPs or disable the user.

Can I override AccessDeniedException to resolve this? Is it advisable? Of course, instead of directly calling AccessDeniedException, I could have another service that does the above registration steps and throws an AccessDeniedException.

Thoughts?

Thank!

+3


source to share





All Articles