dti3914 2013-09-10 21:01
浏览 53
已采纳

Symfony 2:使用ip保护登录页面和管理员

I would like to protect my administrator folder like this:

access_control:
    - { path: ^/administrator/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: myip }
    - { path: ^/administrator, roles: ROLE_SUPER_ADMIN, ip: myip }
    - { path: ^/administrator, roles: ROLE_NO_ACCESS }

when accessing the administrator folder from another ip address it throws me to the login page and reports a redirect loop. Can someone explain me why don't i get an Access forbidden error instead of the redirect loop error?

  • 写回答

1条回答 默认 最新

  • doucan9079 2013-09-10 21:29
    关注

    Your login is also secured with your ip requirement, so an access denied error you get redirect to the login page, but you get an acces denied too, redirect to the same page, access denied, redirect, and so on.

    Remove the IP requirement from your login page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?