简体   繁体   English

Symfony2 form_login-不想重定向

[英]Symfony2 form_login - don't want it to redirect

With symfony2's Security system, you can specify a form_login type of login as a login system under the firewall section of the security config file (see: http://symfony.com/doc/2.0/reference/configuration/security.html ). 使用symfony2的安全系统,您可以在安全配置文件的防火墙部分(请参阅: http ://symfony.com/doc/2.0/reference/configuration/security.html)下指定登录的form_login类型作为登录系统。

Now we have a login_path parameter and when a user tries to access a site that is secure (needs AUTHENTICATION (and later on AUTHORIZATION)) they are redirected to the login form with a HTTP 302 response. 现在我们有了一个login_path参数,当用户尝试访问一个安全的站点(需要AUTHENTICATION(以后需要AUTHORIZATION))时,它们将被重定向到HTTP 302响应的登录表单。 However, what I want is a normal page being returned (200) and that it would just say something like "You need to authenticate to continue.". 但是,我要返回的是正常页面(200),它只会说“您需要进行身份验证才能继续”。

I don't want the redirect!!!! 我不要重定向!!!

I would hack through the code myself, but I cannot seem to find where form_login is implemented. 我本人会亲自破解代码,但似乎找不到在何处实现form_login。 Can anyone point me in the right direction, or is there a better way of doing this with Symfony2? 谁能为我指出正确的方向,或者使用Symfony2有更好的方法吗?

您需要在防火墙配置中的form_login下设置use_forward: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM