users@glassfish.java.net

[ot] form authentication with CURL

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Fri, 1 May 2009 19:31:02 +0200

sorry the off-topic, but I need that to test my jersey application

I have this JDBC realm configured in my Glassfish, originally used by
a form based authentication of another application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces/pages/security/login.faces

and now I am trying to call the secure resource with CURL:

This two command works:

curl -c cookies.txt -d "j_username=fgaucho&j_password=test"
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces/pages/security/j_security_check
curl -v -b cookies.txt -X GET
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces/pages/advertisement/publishAdvertisement.faces


Then, I configured the same JDBC realm in my Jersey web-service
descriptors (web.xml and sun-application.xml), but I can't make it
work:


curl -c cookies.txt -d "j_username=fgaucho&j_password=test"
http://fgaucho.dyndns.org:8080/footprint-service/pages/security/j_security_check
curl -v -b cookies.txt -H "Content-Type:application/xml" -H
"Accept:application/json" -X PUT --data-binary @5.xml
http://fgaucho.dyndns.org:8080/footprint-service/user/create

5.xml has an XML with the serialized object ..

disablign security and using curl, it works..

any hint about CURL and form based authentication would be helpful......