I'm using the HWI OAuth Bundle to allow users to login with Google Apps. It allows the user to login as expected.
However, after about 5 minutes the cookie expires and it tries to redirect to /login, but it gets stuck in an infinite redirect loop. It's trying to load /login on port 443, but returning a 302 redirect to the same URL every time. If I clear the Symfony cache on the server, or clear cookies in the browser, it shows the login page and works again.
// security.yml:
firewalls:
secured_area:
anonymous: ~
oauth:
resource_owners:
google: "/login/check-google"
oauth_user_provider:
service: my.security.userprovider
login_path: /login/
failure_path: /login/
form_login:
login_path: /login/
logout:
path: /logout
target: /login/
access_control:
- { path: ^/(_(profiler|wdt)|css|images|js)/, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: ROLE_STAFF, host: %cms% }
The urls are structured so that:
- Everything on admin.example.com is secured
- Everything on any other subdomain is public. Subdomains are generated dynamically.
There is nothing in the nginx, Symfony2 or FPM logs. I've put the same code on a different server in production environment, and the same thing happens. I can't work out whether it's the security bundle, the HWI OAuth bundle, or something in between.
So, question is which method is producing the redirect, and how do I stop it?
{ path: ^/, role: ROLE_STAFF, host: %cms% }, what do you mean by%cms%? - cheesemacflyparameters.yml, referring to the admin.example.com URL. - Dan Blows{ path: ^/, role: ROLE_STAFF, host: %cms% }it requires you to be in the roleROLE_STAFFto access^/which is false when you are not logged in. So it has no way to reach/login/when you have been logged out because it is under^/. - cheesemacfly