Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Logon to Orion with curl

Hi Christian,

The authentication is based on a session token so that value needs to be present in subsequent HTTP calls. I don't understand why your first pair of commands works while your second pair doesn't though. You should be able to see from the contents of the cookies file whether the initial authentication succeeded.

John



From:        Christian Halstrick <christian.halstrick@xxxxxxxxx>
To:        orion-dev@xxxxxxxxxxx,
Date:        01/28/2013 03:12 AM
Subject:        [orion-dev] Logon to Orion with curl
Sent by:        orion-dev-bounces@xxxxxxxxxxx




Hi,

I would like to understand the REST API of orion. In the end I would
like to use nodejs/mocha. But to understand the protocol I start with
curl commands. My problem is that I cannot login correctly.

With the following coommands I can create a new user:

curl -c orion_cookies.txt -d 'store=Orion' -d 'login=user' -d
'password=secret'
http://localhost:8080/login
curl -b orion_cookies.txt -H "Orion-Version:1" -d 'login=newuser' -d
'password=anothersecret'
http://localhost:8080/users

But know I want to login and then list all the workspaces. I try:

curl -c orion_cookies.txt -d 'store=Orion' -d 'login=user' -d
'password=secret'
http://localhost:8080/login
curl -i -v -b orion_cookies.txt -H "EclipseWeb-Version: 1.0"
http://localhost:8080/workspace

In the second call I get a 302 response (attached below) redirecting
me to the login page. Strangely: If I modify orion_cookies.txt to
contain a valid JSESSIONID (got with firebug from a session in my
browser) then everything is ok. So: I conclude that my login is
incorrect. Any ideas?

Ciao
 Chris

----- Response from GET /workspace call

* About to connect() to localhost port 8080 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /workspace HTTP/1.1
> User-Agent: curl/7.27.0
> Host: localhost:8080
> Accept: */*
> Cookie: JSESSIONID=18xbbg9qccot677f9u27gp1k3
> EclipseWeb-Version: 1.0
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 302 Found
HTTP/1.1 302 Found
< WWW-Authenticate: FORM
WWW-Authenticate: FORM
< Location:
http://localhost:8080/mixloginstatic/LoginWindow.html?redirect=http://localhost:8080/workspace
Location:
http://localhost:8080/mixloginstatic/LoginWindow.html?redirect=http://localhost:8080/workspace
< Content-Length: 0
Content-Length: 0
< Server: Jetty(8.1.3.v20120522)
Server: Jetty(8.1.3.v20120522)

<
* Connection #0 to host localhost left intact
* Closing connection #0
_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev



Back to the top