Hi folks,
I'm using geonetwork 2.10 on ubuntu 13.04. I've successfully exported my
metadata with mef.export service.
By now I need to import it into another geonetwork 2.10 also running on
ubuntu 13.04. I thought it would be as easy as the export procedure.
However, my try on the mef.import service did not work. I read the docs
where it says "Only users with the Administrator profile can run this
service". Then I tried the following (as explained by the user BartO in
http://osgeo-org.1560.x6.nabble.com/mef-import-with-curl-td3860332.html#a3860335
):
$ curl -v -c cookie.txt -XPOST -H 'Content-type: application/xml' -d
'<?xml version="1.0"
encoding="UTF-8"?><request><username>admin</username><password>admin</password></request>'
http://localhost:8080/geonetwork/srv/en/xml.user.login
== Here the output of this command: ==
* Adding handle: conn: 0x1090b30
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1090b30) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
POST /geonetwork/srv/en/xml.user.login HTTP/1.1
User-Agent: curl/7.32.0
Host: localhost:8080
Accept: */*
Content-type: application/xml
Content-Length: 118
* upload completely sent off: 118 out of 118 bytes
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 20 Nov 2013 21:19:24 GMT
< Location: /geonetwork/srv/eng/xml.user.login
< Content-Length: 0
* Server Jetty(7.3.1.v20110307) is not blacklisted
< Server: Jetty(7.3.1.v20110307)
<
* Connection #0 to host localhost left intact
== Here is the output log of jetty: ==
2013-11-20 17:15:55,884 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Public
object - authentication not attempted
2013-11-20 17:15:55,899 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Secure
object: FilterInvocation: URL: /srv/en/xml.user.login; Attributes:
[permitAll]
2013-11-20 17:15:55,900 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Previously
Authenticated:
org.springframework.security.authentication.AnonymousAuthenticationToken@anonymised.com:
Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true;
Details:
org.springframework.security.web.authentication.WebAuthenticationDetails@anonymised.com:
RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities:
ROLE_ANONYMOUS
2013-11-20 17:15:55,900 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] -
Authorization successful
2013-11-20 17:15:55,900 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] -
RunAsManager did not change Authentication object
== I believe this command did not work because of the result of the import
command, as follows: ==
$ curl -v -b cookie.txt -F 'file_type=mef' -F 'mefFile=@./mef.export.19'
http://localhost:8080/geonetwork/srv/en/mef.import
== The output of this command ==
* Adding handle: conn: 0x1a9bbf0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1a9bbf0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
POST /geonetwork/srv/en/mef.import HTTP/1.1
User-Agent: curl/7.32.0
Host: localhost:8080
Accept: */*
Content-Length: 12912897
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=------------------------853ba69e926cd2f4
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 20 Nov 2013 21:21:28 GMT
< Location: /geonetwork/srv/eng/mef.import
< Content-Length: 0
< Connection: close
* Server Jetty(7.3.1.v20110307) is not blacklisted
< Server: Jetty(7.3.1.v20110307)
<
* Closing connection 0
== Here is the output log of jetty for this last command: ==
2013-11-20 17:21:28,899 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Public
object - authentication not attempted
2013-11-20 17:21:28,903 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Secure
object: FilterInvocation: URL: /srv/en/mef.import; Attributes: [permitAll]
2013-11-20 17:21:28,904 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] - Previously
Authenticated:
org.springframework.security.authentication.AnonymousAuthenticationToken@anonymised.com:
Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true;
Details:
org.springframework.security.web.authentication.WebAuthenticationDetails@anonymised.com:
RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities:
ROLE_ANONYMOUS
2013-11-20 17:21:28,904 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] -
Authorization successful
2013-11-20 17:21:28,904 DEBUG
[jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] -
RunAsManager did not change Authentication object
== Other searches about the login service on GN 2.10 ==
Jose Garcia wrote (
http://sourceforge.net/mailarchive/forum.php?thread_name=CAOcMK%3Dh2k_Y46y2a7SSKTyc3WuuSW%2BgAE9urzdbVN7Vps1SoaA%40mail.gmail.com&forum_name=geonetwork-users)
that "GeoNetwork 2.10 uses Spring Security and no longer the xml.login
service. If I'm not wrong, Basic Authentication is enabled by default, so
you can send the credentials in the http request header."
And Ricardo Garcia Silva wrote that "I was able to login successfully by
issuing an HTTP POST request to:
http://localhost:8080/geonetwork/j_spring_security_check ..." (
http://osgeo-org.1560.x6.nabble.com/XML-Login-Service-in-Geonetwork-2-10-td5064670.html
)
I also found a permanent link in the file
./geonetwork/WEB-INF/urlrewrite.xml (line 149) from xml.user.login to the
j_spring_security_check: <from>^.*/.*/xml.user.login(\?.*)</from> <to
type="permanent-redirect"
last="true">%{context-path}/j_spring_security_check$1</to>. From what I
understand that accessing xml.user.login is the same as access
j_spring_security_check.
Following, I looked for the j_spring_security_check file and found it in
/usr/local/geonetwork/web/geoserver/j_spring_security_check but it is
empty.
Then I would like to ask: Looking at the logs above, does someone knows
whether to login worked or not for me ? And looking at the logs of the
mef.import command above, was the login fail the reason for it doesn't work
?
Thank you,
Alex Lopes Pereira