hey, i make this and it work perfectly, and i give it to all that require it
//-------------------------------------------------------------------------
public static function loginGeoserver($username, $password) {
$post_data['username'] = $username;
$post_data['password'] = $password;
foreach ( $post_data as $key => $value){$post_items = $key . '=' . $value;}
$post_string = implode ('&', $post_items);
$curl_connection = curl_init('http://'.master::$host.'/geoserver/j_spring_security_check');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($curl_connection);
$arrInfo=curl_getinfo($curl_connection);
$url=$arrInfo['url'];
parse_str($url, $output);
$trans = array("." => "_");
$base = strtr(master::$host, $trans);
if(master::getLoggedUser()->tieneRol("Operador"))
$str = "http://".$base."/geoserver/web/;jsessionid";
$str = "http://".$base."/geoserver/;jsessionid";
curl_close($curl_connection);
setcookie('JSESSIONID',$output[$str],0,'/geoserver');
setcookie('JSESSIONID',$output[$str],0,'/');
}
//-----------------------------------------------------------------------
but the logout dont work in the server side, only works in the client browser if i delete the cookies, it means that, if i dont delete the cookie, somebody can entry the geoserver, and i want that geoserver logsout the session itself here is the code that i implements,help me with efectly solution or repairing the mistake shown here, thanks to all,
//------------------------------------------------------------------------
public static function logoutGeoserver() {
$curl_connection = curl_init('http://'.master::$host.'/geoserver/j_spring_security_logout');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_COOKIESESSION, true);
curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $curl_connection, CURLOPT_COOKIE, 'JSESSIONID=' . $_COOKIE['JSESSIONID'] . '; path=/geoserver' );
$result = curl_exec($curl_connection);
curl_close($curl_connection);
//setcookie('JSESSIONID','',time()-3600,'/geoserver');
//setcookie('JSESSIONID','',time()-3600,'/');
}
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/