登录后重定向
Redirect after being logged
我想知道是否有办法将 propio security.yml 文件放入,例如:
web:
pattern: ^/web
oauth:
resource_owners:
facebook: "/web/login/check-facebook"
google: "/web/login/check-google"
linkedin: "/web/login/check-linkedin"
login_path: /
failure_path: /
default_target_path: /
check_path: /web/login_check
同样有 login_path: / 有东西要 login_sucess_path?
从第128行开始给出了登录后重定向的参数,即:
# login success redirecting options (read further below)
always_use_default_target_path: false
default_target_path: /
target_path_parameter: _target_path
use_referer: false
# login failure redirecting options (read further below)
failure_path: /foo
failure_forward: false
failure_path_parameter: _failure_path
failure_handler: some.service.id
success_handler: some.service.id
所以是的,它确实有类似于 login_success_path
的东西,即 default_target_path
。
hwi_oauth_connect_service:
pattern: /service/{service}
defaults: { _controller: DelivveWebBundle:Default:connectService}
目前我重写了这条路线
我的控制器中有以下方法
public function connectServiceAction() #(Request $request, $service)
{
$user = $this->container->get('security.context')->getToken()->getUser();
return $this->container->get('templating')->renderResponse('default/index.html.twig');
}
我想知道是否有办法将 propio security.yml 文件放入,例如:
web:
pattern: ^/web
oauth:
resource_owners:
facebook: "/web/login/check-facebook"
google: "/web/login/check-google"
linkedin: "/web/login/check-linkedin"
login_path: /
failure_path: /
default_target_path: /
check_path: /web/login_check
同样有 login_path: / 有东西要 login_sucess_path?
从第128行开始给出了登录后重定向的参数,即:
# login success redirecting options (read further below)
always_use_default_target_path: false
default_target_path: /
target_path_parameter: _target_path
use_referer: false
# login failure redirecting options (read further below)
failure_path: /foo
failure_forward: false
failure_path_parameter: _failure_path
failure_handler: some.service.id
success_handler: some.service.id
所以是的,它确实有类似于 login_success_path
的东西,即 default_target_path
。
hwi_oauth_connect_service:
pattern: /service/{service}
defaults: { _controller: DelivveWebBundle:Default:connectService}
目前我重写了这条路线
我的控制器中有以下方法
public function connectServiceAction() #(Request $request, $service)
{
$user = $this->container->get('security.context')->getToken()->getUser();
return $this->container->get('templating')->renderResponse('default/index.html.twig');
}