This is some python code I use for GN 2.10 logins
url='%s/geonetwork'%(server)
loginservice='j_spring_security_check' # replaces 'xml.user.login'
searchservice='srv/eng/xml.search'
delservice='srv/eng/metadata.delete'
handler=urllib2.HTTPHandler()
#This is so we avoid our proxy as urllib2 picks up the systemwide settings
proxy = urllib2.ProxyHandler({})
#Login and get a cookie to use in the next call to the server
data = urllib.urlencode({'username':username,'password':password})
request = urllib2.Request('%s/%s'%(url, loginservice), data)
cookie = urllib2.HTTPCookieProcessor(cookielib.LWPCookieJar())
self.opener = urllib2.build_opener(handler, proxy, cookie)
try:
result=opener.open(request)
assert ('failure=true' not in result.url)
except AssertionError:
raise RuntimeError('Login failed!')
# Rest of script etc...
data=urllib.urlencode({'request':query})
request = urllib2.Request('%s/%s'%(url, searchservice), data)
Luke
-----Original Message-----
From: Jo Cook [mailto:jocook@anonymised.com]
Sent: Thursday, 19 February 2015 3:09 AM
To: Jose Garcia
Cc: geonetwork-users@lists.sourceforge.net
Subject: Re: [GeoNetwork-users] Confirm changes to xml.user.login service in Geonetwork 2.10.4
Hi Jose,
Damn, I spent ages trying to understand why this wasn't working, because
it's still in the documentation 
In the example python script you link to, the login URL is still the
xml.user.login one- so what would I use in it's place?
If I wanted to submit a pull request to get this updated in the
documentation, could I just change the raw markdown file or would I need to
do anything else?
Thanks
Jo
On Wed, Feb 18, 2015 at 11:32 AM, Jose Garcia <jose.garcia@anonymised.com>
wrote:
Hi Jo
In 2.10 GeoNetwork was changed to use Spring Security, so xml.user.login
and xml.user.logout are not longer used.
You can use Basic Authentication for your requests. If you're going to do
several requests, the best way to handle this is to make a first request
with the BA credentials and grab the cookies (JSESSIONID), re-using them in
the following requests, that way avoids to create several server sessions.
A similar approach (not using Basic Auth, but should be similar) to grab
and reuse the cookies can be found in
https://trac.osgeo.org/geonetwork/wiki/HowToDoCSWTransactionOperations
Regards,
Jose García
On Wed, Feb 18, 2015 at 11:35 AM, Jo Cook <jocook@anonymised.com>
wrote:
Hi List,
On my 2.10.4 installation it seems as if the xml.user.login service no
longer works. I tried the approach of adding it into config.xml and adding
the security mappings to config-security-mappings.xml but that didn't
work.
Another mailing list ticket suggested that there has been a change to the
way that security is now done, and that this might not work at all now?
Can someone confirm this for me, and give me some pointers as to how to do
remote logins using get and post under 2.10.4 onwards?
Many thanks
Jo
--
*Jo Cook*
Astun Technology Ltd, The Coach House, 17 West Street, Epsom, Surrey, KT18
7RL, UK
t:+44 7930 524 155
iShare - Data integration and publishing platform
<http://www.isharemaps.com/>
*****************************************
Company registration no. 5410695. Registered in England and Wales.
Registered office: 120 Manor Green Road, Epsom, Surrey, KT19 8LN VAT no.
864201149.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
*GeoCat Bridge for ArcGIS allows instant publishing of data and metadata
on GeoServer and GeoNetwork. Visit http://geocat.net
<http://geocat.net/> for details. _________________________Jose
GarcíaGeoCat bvVeenderweg 136721 WD BennekomThe
Netherlandshttp://GeoCat.net/>*
--
*Jo Cook*
Astun Technology Ltd, The Coach House, 17 West Street, Epsom, Surrey, KT18
7RL, UK
t:+44 7930 524 155
iShare - Data integration and publishing platform
<http://www.isharemaps.com/>
*****************************************
Company registration no. 5410695. Registered in England and Wales.
Registered office: 120 Manor Green Road, Epsom, Surrey, KT19 8LN VAT no.
864201149.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork