[Geoserver-users] PHP , Geoserver 2.2, CURL and j_spring_security_check

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/

I am not a PHP developer, but the exception you see in the log is a warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

···

2013/5/18 <islanis@anonymised.com>

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/


AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

Hi

First, please stay on the users list.

Return code 200 is fine, does your PHP library follow HTTP redirects. After a login, an HTTP redirect happens to the admin GUI and this redirect must include the session cookie called JSESSIONID.

Next problem is your GeoServer version. 2.2.x is out of support. If I find a bug, I can only fix it in 2.3.x series. After you have installed 2.2.x and migrated your data directory (this happens automatically), you should install 2.3.2 .

Do you need access to the GUI or the OGC services. I assume the second one and in this case, you should use basic authentication.

Cheers

Christian

···

2013/5/19 J.Alejandro Martinez Linares <islanis@anonymised.com>

This is what i get when a analize the return of the curl request i made this die(printf_r($arrInfo)) and i get this:


Array ( [url] => http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?wicket:bookmarkablePage=:org.geoserver.web.GeoServerLoginPage&error=true [content_type] => text/html; charset=utf-8 [http_code] => 200 [header_size] => 687 [request_size] => 618 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 14.234 [namelookup_time] => 0 [connect_time] => 0 [pretransfer_time] => 0.047 [size_upload] => 0 [size_download] => 15662 [speed_download] => 1100 [speed_upload] => 0 [download_content_length] => 15662 [upload_content_length] => 0 [starttransfer_time] => 9.687 [redirect_time] => 4.547 [certinfo] => Array ( ) [primary_ip] => 127.0.0.1 [primary_port] => 80 [local_ip] => 127.0.0.1 [local_port] => 1232 [redirect_url] => ) 1

and reading this the http return code is 200, but i can not get in when this is made, this is not authenticating fine, what i am doing wrong, y the version 2.1.4 this same routine works fine, but in this version 2.2 of geoserver the routine is not working, help me please.

On 19/05/13 01:38, Christian Mueller wrote:

I am not a PHP developer, but the exception you see in the log is a warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

2013/5/18 <islanis@anonymised.com>

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/


AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

"Christian Mueller" <christian.mueller@anonymised.com> escribió:

Hi

First, please stay on the users list.

Return code 200 is fine, does your PHP library follow HTTP redirects. After
a login, an HTTP redirect happens to the admin GUI and this redirect must
include the session cookie called JSESSIONID.

Next problem is your GeoServer version. 2.2.x is out of support. If I find
a bug, I can only fix it in 2.3.x series. After you have installed 2.2.x
and migrated your data directory (this happens automatically), you should
install 2.3.2 .

i will get 2.3.2 in these days, thanks

Do you need access to the GUI or the OGC services. I assume the second one
and in this case, you should use basic authentication.

yes i want to use access to the OGC services, how in these version could i use basic authentication, i have curl in my pc, do you please can put an example of a curl sentence and the reply of the same in case of the sentence is fine and in contrary case, to know when the log is fine or not, please, thanks.

Cheers
Christian

2013/5/19 J.Alejandro Martinez Linares <islanis@anonymised.com>

This is what i get when a analize the return of the curl request i made
this die(printf_r($arrInfo)) and i get this:

------------------
Array ( [url] =>
http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?wicket:bookmarkablePage=:org.geoserver.web.GeoServerLoginPage&error=true[content_type] => text/html; charset=utf-8 [http_code] => 200 [header_size]
=> 687 [request_size] => 618 [filetime] => -1 [ssl_verify_result] => 0
[redirect_count] => 1 [total_time] => 14.234 [namelookup_time] => 0
[connect_time] => 0 [pretransfer_time] => 0.047 [size_upload] => 0
[size_download] => 15662 [speed_download] => 1100 [speed_upload] => 0
[download_content_length] => 15662 [upload_content_length] => 0
[starttransfer_time] => 9.687 [redirect_time] => 4.547 [certinfo] => Array
( ) [primary_ip] => 127.0.0.1 [primary_port] => 80 [local_ip] => 127.0.0.1
[local_port] => 1232 [redirect_url] => ) 1
---------------------

and reading this the http return code is 200, but i can not get in when
this is made, this is not authenticating fine, what i am doing wrong, y the
version 2.1.4 this same routine works fine, but in this version 2.2 of
geoserver the routine is not working, help me please.

On 19/05/13 01:38, Christian Mueller wrote:

I am not a PHP developer, but the exception you see in the log is a
warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

2013/5/18 <islanis@anonymised.com>

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/

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

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

I know curl from the command line, int his case

curl --basic -u admin:geoserver …

should do the job. You have to include this parameter in EACH of your curl requests.

Cheers

Christian

···

2013/5/20 <islanis@anonymised.com>

“Christian Mueller” <christian.mueller@anonymised.com…5602…solutions.at> escribió:

Hi

First, please stay on the users list.

Return code 200 is fine, does your PHP library follow HTTP redirects. After
a login, an HTTP redirect happens to the admin GUI and this redirect must
include the session cookie called JSESSIONID.

Next problem is your GeoServer version. 2.2.x is out of support. If I find
a bug, I can only fix it in 2.3.x series. After you have installed 2.2.x
and migrated your data directory (this happens automatically), you should
install 2.3.2 .

i will get 2.3.2 in these days, thanks

Do you need access to the GUI or the OGC services. I assume the second one
and in this case, you should use basic authentication.

yes i want to use access to the OGC services, how in these version could i use basic authentication, i have curl in my pc, do you please can put an example of a curl sentence and the reply of the same in case of the sentence is fine and in contrary case, to know when the log is fine or not, please, thanks.

Cheers
Christian

2013/5/19 J.Alejandro Martinez Linares <islanis@anonymised.com>

This is what i get when a analize the return of the curl request i made
this die(printf_r($arrInfo)) and i get this:


Array ( [url] =>
http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?wicket:bookmarkablePage=:org.geoserver.web.GeoServerLoginPage&error=true[content_type] => text/html; charset=utf-8 [http_code] => 200 [header_size]
=> 687 [request_size] => 618 [filetime] => -1 [ssl_verify_result] => 0
[redirect_count] => 1 [total_time] => 14.234 [namelookup_time] => 0
[connect_time] => 0 [pretransfer_time] => 0.047 [size_upload] => 0
[size_download] => 15662 [speed_download] => 1100 [speed_upload] => 0
[download_content_length] => 15662 [upload_content_length] => 0
[starttransfer_time] => 9.687 [redirect_time] => 4.547 [certinfo] => Array
( ) [primary_ip] => 127.0.0.1 [primary_port] => 80 [local_ip] => 127.0.0.1
[local_port] => 1232 [redirect_url] => ) 1

and reading this the http return code is 200, but i can not get in when
this is made, this is not authenticating fine, what i am doing wrong, y the
version 2.1.4 this same routine works fine, but in this version 2.2 of
geoserver the routine is not working, help me please.

On 19/05/13 01:38, Christian Mueller wrote:

I am not a PHP developer, but the exception you see in the log is a
warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

2013/5/18 <islanis@anonymised.com>

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/


AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH


DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH


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/

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

and what are the return code that i would get to know that the log in is fine or not

"Christian Mueller" <christian.mueller@anonymised.com> escribió:

I know curl from the command line, int his case

curl --basic -u admin:geoserver ......

should do the job. You have to include this parameter in EACH of your curl
requests.

Cheers
Christian

2013/5/20 <islanis@anonymised.com>

"Christian Mueller" <christian.mueller@anonymised.com**solutions.at<christian.mueller@anonymised.com>>
escribió:

Hi

First, please stay on the users list.

Return code 200 is fine, does your PHP library follow HTTP redirects.
After
a login, an HTTP redirect happens to the admin GUI and this redirect must
include the session cookie called JSESSIONID.

Next problem is your GeoServer version. 2.2.x is out of support. If I find
a bug, I can only fix it in 2.3.x series. After you have installed 2.2.x
and migrated your data directory (this happens automatically), you should
install 2.3.2 .

i will get 2.3.2 in these days, thanks

Do you need access to the GUI or the OGC services. I assume the second one
and in this case, you should use basic authentication.

yes i want to use access to the OGC services, how in these version could i
use basic authentication, i have curl in my pc, do you please can put an
example of a curl sentence and the reply of the same in case of the
sentence is fine and in contrary case, to know when the log is fine or not,
please, thanks.

Cheers
Christian

2013/5/19 J.Alejandro Martinez Linares <islanis@anonymised.com>

  This is what i get when a analize the return of the curl request i made

this die(printf_r($arrInfo)) and i get this:

------------------
Array ( [url] =>
http://localhost/geoserver/**web/;jsessionid=zusl8frwtoz4?**
wicket:bookmarkablePage=:org.**geoserver.web.**
GeoServerLoginPage&error=true[**content_type]<http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?wicket:bookmarkablePage=:org.geoserver.web.GeoServerLoginPage&error=true[content_type]&gt;=&gt; text/html; charset=utf-8 [http_code] => 200 [header_size]
=> 687 [request_size] => 618 [filetime] => -1 [ssl_verify_result] => 0
[redirect_count] => 1 [total_time] => 14.234 [namelookup_time] => 0
[connect_time] => 0 [pretransfer_time] => 0.047 [size_upload] => 0
[size_download] => 15662 [speed_download] => 1100 [speed_upload] => 0
[download_content_length] => 15662 [upload_content_length] => 0
[starttransfer_time] => 9.687 [redirect_time] => 4.547 [certinfo] =>
Array
( ) [primary_ip] => 127.0.0.1 [primary_port] => 80 [local_ip] =>
127.0.0.1
[local_port] => 1232 [redirect_url] => ) 1
---------------------

and reading this the http return code is 200, but i can not get in when
this is made, this is not authenticating fine, what i am doing wrong, y
the
version 2.1.4 this same routine works fine, but in this version 2.2 of
geoserver the routine is not working, help me please.

On 19/05/13 01:38, Christian Mueller wrote:

I am not a PHP developer, but the exception you see in the log is a
warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

2013/5/18 <islanis@anonymised.com>

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.**
HttpSessionSecurityContextRepo**sitory$**SaveToSessionResponseWrapper.*
*createNewSessionIfAllowed(**HttpSessionSecurityContextRepo**
sitory.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/

------------------------------**------------------------------**
------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/**alienvault_d2d&lt;http://p.sf.net/sfu/alienvault_d2d&gt;
______________________________**_________________
Geoserver-users mailing list
Geoserver-users@anonymised.com**sourceforge.net<Geoserver-users@anonymised.comceforge.net>
https://lists.sourceforge.net/**lists/listinfo/geoserver-users&lt;https://lists.sourceforge.net/lists/listinfo/geoserver-users&gt;

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

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

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

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

An HTTP 200. Since the login happens for each request, you would get a 401 (unauthorized) or 403 (Forbidden) in case of failure.

You must check the HTTP return code for each request, but this is independent of authentication.

Cheers

···

2013/5/20 <islanis@anonymised.com>

and what are the return code that i would get to know that the log in is fine or not

“Christian Mueller” <christian.mueller@anonymised.comsolutions.at> escribió:

I know curl from the command line, int his case

curl --basic -u admin:geoserver …

should do the job. You have to include this parameter in EACH of your curl
requests.

Cheers
Christian

2013/5/20 <islanis@anonymised.com>

“Christian Mueller” <christian.mueller@anonymised.com**solutions.at<christian.mueller@anonymised.comsolutions.at>>

escribió:

Hi

First, please stay on the users list.

Return code 200 is fine, does your PHP library follow HTTP redirects.
After
a login, an HTTP redirect happens to the admin GUI and this redirect must
include the session cookie called JSESSIONID.

Next problem is your GeoServer version. 2.2.x is out of support. If I find
a bug, I can only fix it in 2.3.x series. After you have installed 2.2.x
and migrated your data directory (this happens automatically), you should
install 2.3.2 .

i will get 2.3.2 in these days, thanks

Do you need access to the GUI or the OGC services. I assume the second one
and in this case, you should use basic authentication.

yes i want to use access to the OGC services, how in these version could i
use basic authentication, i have curl in my pc, do you please can put an
example of a curl sentence and the reply of the same in case of the
sentence is fine and in contrary case, to know when the log is fine or not,
please, thanks.

Cheers
Christian

2013/5/19 J.Alejandro Martinez Linares <islanis@anonymised.com>

This is what i get when a analize the return of the curl request i made

this die(printf_r($arrInfo)) and i get this:


Array ( [url] =>

http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?
wicket:bookmarkablePage=:org.geoserver.web.
GeoServerLoginPage&error=true[**content_type]<http://localhost/geoserver/web/;jsessionid=zusl8frwtoz4?wicket:bookmarkablePage=:org.geoserver.web.GeoServerLoginPage&error=true[content_type]>=> text/html; charset=utf-8 [http_code] => 200 [header_size]

=> 687 [request_size] => 618 [filetime] => -1 [ssl_verify_result] => 0
[redirect_count] => 1 [total_time] => 14.234 [namelookup_time] => 0
[connect_time] => 0 [pretransfer_time] => 0.047 [size_upload] => 0
[size_download] => 15662 [speed_download] => 1100 [speed_upload] => 0
[download_content_length] => 15662 [upload_content_length] => 0
[starttransfer_time] => 9.687 [redirect_time] => 4.547 [certinfo] =>
Array
( ) [primary_ip] => 127.0.0.1 [primary_port] => 80 [local_ip] =>
127.0.0.1
[local_port] => 1232 [redirect_url] => ) 1

and reading this the http return code is 200, but i can not get in when
this is made, this is not authenticating fine, what i am doing wrong, y
the
version 2.1.4 this same routine works fine, but in this version 2.2 of
geoserver the routine is not working, help me please.

On 19/05/13 01:38, Christian Mueller wrote:

I am not a PHP developer, but the exception you see in the log is a
warning, it does not prevent functionality.

Is there another exception ?
What is your HTTP return code ?

Cheers
Christian

2013/5/18 <islanis@anonymised.com>

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.
HttpSessionSecurityContextRepo**sitory$*SaveToSessionResponseWrapper.
*createNewSessionIfAllowed(HttpSessionSecurityContextRepo
sitory.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/

------------------------------------------------------------


AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.

http://p.sf.net/sfu/**alienvault_d2d<http://p.sf.net/sfu/alienvault_d2d>
_____________**
Geoserver-users mailing list
Geoserver-users@anonymised.com**sourceforge.net<Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/**lists/listinfo/geoserver-users<https://lists.sourceforge.net/lists/listinfo/geoserver-users>


DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH


DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

----------------------------------------------------------------

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/


DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH


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/

DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH