0
我正在为我的应用程序开发SSO解决方案。 我有一个主要的域accounts.mydomain.com用户进行登录。登录成功后,我需要在所有其他域中验证用户身份。使用curl在多个域进行身份验证(php/symfony 1.4)
每次用户登录时,我都会创建一个身份验证令牌,然后对每个域的连接方法进行调用,读取令牌,从数据库获取用户,然后在该域中登录该用户。
一切工作正常,但用户我不能坚持在其他领域的用户会话。
这是我的代码:(使用symfony的1.4):
My main login action:
<?php
// get a auth token for the user
(...)
// cycle through all my domains and make a curl request to the connect action of each one
// passing the auth token
foreach(sfConfig::get('app_connect_urls') as $url){
$url.= '?auth_token='.$authToken;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$curlResult = curl_exec($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
我通过卷曲
$authToken = $request->getParameter('auth_token');
// $user = get user from token (...)
$this->getUser()->signIn($user);
echo $this->getUser()->isAuthenticated() // returns true;
return sfView::NONE;
叫其他领域的连接操作。如果我去该域的用户未通过身份验证。如果我直接调用操作,会话将持续。
感谢您的帮助。
的Cookie不被由卷曲称为URL设置。 – brpaz