0
我知道一个成功的用户登录后,我可以做一个重定向到URL:重定向到一个路由的用户登录后
return $this->redirect()->toUrl('/user/login?redirect=http://www.myurl.com');
现在,我愿意做同样的事情,而不是注册的路线:
'sso-post-login' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/sso-post-login',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'sso-post-login',
),
'may_terminate' => true,
),
),
但下面不工作:
return $this->redirect()->toUrl('/user/login?redirect=/sso-post-login');
它不打我的行动:
public function ssoPostLoginAction() {
error_log("In sso post login action");
$originUrl = Common::getCookie('sso_post_login', $this->getRequest());
$sessionCookie = Common::getCookie('PHPSESSID', $this->getRequest());
if (null != $sessionCookie && null != $this->getUserService()->getAuthService()->getIdentity()) {
$email = $this->getUserService()->getAuthService()->getIdentity()->getEmail();
$jwtCredentials = $this->buildJWTLoginToken($email);
$originUrl .= "?jwt=" . $jwtCredentials;
return $this->redirect()->toUrl($originUrl);
}
}
它只是在登录完成后重定向到主页面。
没有,没有任何理由,我很乐意使用,将工作的任何解决方案。我试过你的解决方案,但它重定向到主页面,而不是重定向到'sso-post-login'。 – Stephane
您确定您可以在浏览器中访问“http:// www.myurl.com/sso-post-login”吗?它不会抛出任何错误或重定向到主页面吗? – SzymonM
确实,就是这样。我忘了将它再次添加到'bjyauthorize.php'文件中。 – Stephane