I'm searching for a while now, for any info, on how to do something after authentication success in symfony2. I want to rehash user password to use bcrypt just after successful authentication using old hash. I need to do this when I still have valid plain password so it should be just after credentials check and before redirect.
Any clues how to achieve that?
I found something about event dispatcher in Symfony but I can't find if there is any event after successful authentication.
Please correct me if I'm trying to do this wrong way and suggest some better approach.
//EDIT
Ok I found event fired just after auth success, it's called security.authentication.success
. So i can now attach to this event but now I'm not sure where in my boundle code should I attach my event listener? Should I do that in my /src/Pkr/BlogUserBundle/DependencyInjection/PkrBlogUserExtension.php
in load()
method?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…