문제

Which is the best method to implement role based redirect after login in FOSUserBundle ?

Should I use a success handler and write the redirection logic in onAuthenticationSuccess

or Should I use a security listener and write the redirection logic in onSecurityInteractiveLogin

도움이 되었습니까?

해결책

I think security listeners are used by other bundles to do some post-login operations like table update, setting cookie etc. While same can be done by success_handler, it is called once for each firewall configuration in app/config/security.yml. So you have full control over it. So I think it is better to implement redirection logic in onAuthenticationSuccess method of your success_handler service class.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top