I need to use https in Symfony 2.2 but only if user is fully authenticated.
How can I force authenticated user to HTTPS in Symfony2 after fully authentication only?
215 Views Asked by Rajesh Meniya At
2
There are 2 best solutions below
0

You'll need to create a RequestEventListener, fired after routing and security, to handle in it
1) the security context (see if user is fully authenticated)
2) the actual asked route in the router component (and match it with a configuration array)
to then decide or not to force redirect to https if not already the case.
Just got solution using onKernalRequest event listener.
My onKernelRequest event service :
Register service
access_control in security.yml