Hi Kumaran
In my case, I am using Python to access geonetwork. I am doing a normal
POST request, using directly the variables (without XML), like so:
# Python code
import requests
session = requests.Session()
url = 'http://localhost:8080/geonetwork/j_spring_security_check’
params = {'username' : 'my_user', 'password' : 'my_password'}
response = session.post(url, data=params)
It works nicely and the session object saves the login cookies allowing
further interaction with the server.
I am not very knowledgeable in Java, but there should be a similar approach.
Regarding your question about other changes in the xml services, I am
mainly using the CSW service for querying and inserting metadata records
into the catalog.
Coming from version 2.6 to 2.10 I noticed that the url for accessing
geonetwork's csw server has changed a bit. It used to be
http://localhost:8080/geonetwork/srv/en/csw
And now there are two different urls, one for viewing the records and
another for transactions:
http://localhost:8080/geonetwork/srv/eng/csw
http://localhost:8080/geonetwork/srv/eng/csw-publication
Best regards
On Wed, Jul 10, 2013 at 8:21 AM, Kumaran Narayanaswamy <
kumaran@anonymised.com> wrote:
I am using the below Sample Code in Java and I always get Login Not
Successful Message. Do I need to enable any other config for this to
work. I have also tried with the url
http://192.168.1.172:8081/geonetwork/srv/eng/j_spring_security_check and
it did not work.Any help is appreciated. Thanks.
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
public class TestGNLogin {
/**
* @param args
*/
public static void main(String args) {
// TODO Auto-generated method stub
try {
HttpClient httpClient = new HttpClient();
String url =
"http://192.168.1.172:8081/geonetwork/j_spring_security_check";
PostMethod post = new PostMethod(url);
post.addParameter("username", "admin");
post.addParameter("password", "admin");
// Send login request**
httpClient.executeMethod(post);
if(post.getStatusCode() == HttpStatus.SC_OK) {
post.releaseConnection();
System.out.println("Login Successful");
} else {
post.releaseConnection();
System.out.println("Login Not Successful");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
On 10-07-2013 10:18, Kumaran Narayanaswamy wrote:
> Thanks Ricardo Filipe Soares Garcia. Do we need to send the POST data
> in xml format as we used to send in earlier versions or just send the
> username and password in POST request?
>
> Also are there any other changes that we need to consider for other
> XML
> services that you are aware of in the latest 2.10 version?
>
> Thanks again.
>
> Regards
> Kumaran
>
> On 08-07-2013 16:56, Ricardo Filipe Soares Garcia da wrote:
>> Geonetwork 2.10 now uses spring security for logging in/out. I also
>> had
>> this trouble after upgrading, as there doesn't seem to be any notice
>> of
>> this in the documentation.
>>
>> Thankfully there is a working login/logout example in the
>> administration
>> interface, under the test CSW page. Inspecting the underlying
>> javascript
>> code led me to the right URL's.
>>
>> I was able to login successfully by issuing an HTTP POST request to:
>>
>> http://localhost:8080/geonetwork/j_spring_security_check
>>
>> with the following data:
>>
>> usename=my_user
>> password=my_pass
>>
>> For logging out I use also an HTTP POST request to:
>>
>> http://localhost:8080/geonetwork/j_spring_security_logout
>>
>> Maybe you can also use HTTP GET but I haven't tested.
>>
>> Regards
>>
>> On Mon, Jul 8, 2013 at 11:04 AM, Kumaran Narayanaswamy <
>> kumaran@anonymised.com> wrote:
>>
>>>
>>>
>>> Hello,
>>>
>>> We were using Older vesrion of GN with xml.login service from an
>>> external application. We migrated to GN 2.10 and not able to use
>>> the
>>> service and not able to login. In Log I get to see
>>>
>>> 2013-07-05 08:37:49,166 DEBUG
>>> [jeeves.config.springutil.GeonetworkFilterSecurityInterceptor] -
>>> Secure
>>> object: FilterInvocation: URL: /srv/en/xml.user.login; Attributes:
>>> [denyAll]
>>> 2013-07-05 08:37:49,166 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: 192.168.1.212; SessionId: null; Granted
>>> Authorities:
>>> ROLE_ANONYMOUS
>>>
>>>
>>> Do I need to make any additional settings or configuration for
>>> xml.login and other XML Services to work in GN 2.10
>>>
>>> Please let me know. Thanks.
>>>
>>> Regards
>>> Kumaran
>>>
>>>
>>>
------------------------------------------------------------------------------
>>> This SF.net email is sponsored by Windows:
>>>
>>> Build for Windows Store.
>>>
>>> http://p.sf.net/sfu/windows-dev2dev
>>> _______________________________________________
>>> 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
>>>
>
>
------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
>
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&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
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&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
--
___________________________ ___ __
Ricardo Garcia Silva