0

I am using Symfony login system which is symfony will take care of the entire login process for me as long as I got the configuration (firewall) correctly.

How can I perform some custom validation before it performs the authentication process? For example, check the length of username, validate captcha code and etc. If one of the requirement does not meet, I need to stop further action (authentication) and return error message.

I know there is some authentication handlers like authentication success handler or authentication failure handler which allow you to do some action upon authentication successful or failure. Is there any handler like this that allow me put my custom code before performing authentication action?

1 Answer 1

1

You can create a custom authenticator, this is all you need:

http://symfony.com/doc/current/cookbook/security/custom_password_authenticator.html#the-password-authenticator

Sign up to request clarification or add additional context in comments.

2 Comments

Hi, I am using symfony 2.7. I try your solution but getting this error [Unrecognized option "authenticator" under "security.firewalls.main.form_login"]. Do you have any ideal? Seem like the authenticator is not a valid syntax.
Got the problem already, the syntax must be under simple_form. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.