[OpenLayers-Users] PHP , Geoserver 2.2, CURL and j_spring_security_check

islanis at infomed.sld.cu islanis at infomed.sld.cu
Sat May 18 11:53:47 PDT 2013


hello peoples, i need help, i got a problem, i need to auntenticate  
throught php in geoserver, in the past with the version geoserver  
2.1.4 it work fine, but now i want to upgrade my map server to  
geoserver 2.2 and the function dont work here, i dont know what to do,  
help me please, here is the full function that i used and error that  
geoserver 2.2 show, thanks to all.


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() != null) {
             if (master::getLoggedUser()->tieneRol("Operador"))
                 $str = "http://" . $base . "/geoserver/web/;jsessionid";
             $str = "http://" . $base . "/geoserver/;jsessionid";

             curl_close($curl_connection);
             if (!empty($output[$str])) {
             } else {
                 //header('Location:  
/geoportal/index.php?page=home.home&Error=GeoserverDown');
				header('Location: /personal/index.php?page=inicio&Error=GeoserverDown');
             }
             setcookie('JSESSIONID', $output[$str], 0, '/geoserver');
             setcookie('JSESSIONID', $output[$str], 0, '/');
         } else {
             return null;
         }

     }
-------------------------------------------------------
and the geoserver 2.2 logs show this
-----------------------------------------------------
2013-05-17 22:37:48,863 INFO [ows.OWSHandlerMapping] - Mapped URL path  
[/animate/*] onto handler 'dispatcher'
2013-05-17 22:37:49,861 WARN [geoserver.security] -  
E:\geoserver-2.2-RC1-bin\data_dir\security\users.properties.old could  
be removed manually
2013-05-17 22:46:23,167 INFO [geoserver.filters] - Creating a new http  
session outside of the web UI! (normally not desirable), the path  
is/j_spring_security_check
java.lang.Exception: Full stack trace for the session creation path
	at  
org.geoserver.filters.SessionDebugFilter$SessionDebugWrapper.getSession(SessionDebugFilter.java:93)
	at  
javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:227)
	at  
org.springframework.security.web.context.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper.createNewSessionIfAllowed(HttpSessionSecurityContextRepository.java:339)
	at


----------------------------------------------------------------
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/


More information about the Users mailing list