I'm working on Symfon2 and I've read the documentation, I stumbled with a problem belongs to the "Security" Section. I need a custom authentication provider made by me that can persist the token in the session so I can get it in a subsequent requests and if the user didn't provide a correct credential, it will redirect him to a login form and if he provided a correct credentials he would be redirected to another page.
1. [access welcome page (protected page)]
user -------------------------------------------------------> [user redirected to a login form page] ----> [user provide wrong credentials] -----> [user returned to login form page]
2.
[access welcome page (protected page)]
user --------------------------------------------------------> [user redirected to a login form page] ----> [user provide correct credentials]
-------> [user accessed to welcom page]
I want the custom authentication provider to make some stuff (verify user with ldap, db ...etc), then provide a token and save it into the security context, and to put in mind my login forms redirections work correctly (if user credentials are wrong, then the user will be redirected to the login form page, and if they are correct then he will redirected to a welcome page).
In the cookbook there is an article about "How to create a custom Authentication Provider", it's talking about "how to create a custom authentication provider for WSSE authentication."
Later in the article a note is written: A class not used above, the AbstractAuthenticationListener class, is a very useful base class which provides commonly needed functionality for security extensions. This includes maintaining the token in the session, providing success / failure handlers, login form urls, and more. As WSSE does not require maintaining authentication sessions or login forms, it won't be used for this example.
In the example mentioned in the cookbook, ListenerInterface is used, but it cannot be used with login form pages.
If some one solve this problem, I will be very thankful to get the solution.
Best Regards,
Dany