Symfony 2 Securing Login with IP

前端 未结 1 1348
予麋鹿
予麋鹿 2021-01-15 09:55

I have a firewall rule which together with annotations allows only access to actions as specific user.

Additionally I would love to block ANY login if it is not comi

相关标签:
1条回答
  • 2021-01-15 10:45

    If I am not mistaken, what Symfony does here, is try and match the role of the user to what is required for the path. If it doesn't match one of those roles, it sends the user to the login page.

    The problem is, the login page is where the user has just come from. Thus the user gets into an infinite loop as their condition can never be met.

    I would suggest putting the login page itself outside of the firewall and just put the IP check within the code of the LOGIN page and if not met, dump out somewhere else, which isn't within the firewall.

    0 讨论(0)
提交回复
热议问题