Monday, January 2, 2017

curl behind Authentication

curl dm01:8082/nodes

curl -vv -X POST -d username=foo -d password=foo123 dm01:8082/login
* Adding handle: conn: 0x7fcdb980aa00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fcdb980aa00) send_pipe: 1, recv_pipe: 0
* About to connect() to dm01 port 8082 (#0)
* Trying 10.3.48.19...
* Connected to dm01 (10.3.48.19) port 8082 (#0)
> POST /login HTTP/1.1
> User-Agent: curl/7.30.0
> Host: dm01:8082
> Accept: */*
> Content-Length: 28
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 28 out of 28 bytes
< HTTP/1.1 302 Found
< Set-Cookie: session=ufvuwYxNQWg5pjvSRTUyyHA921jwffc8; Max-Age=7776000; HttpOnly
< Set-Cookie: JSESSIONID=15757nag01iw5zxzo52cayz8n;Path=/
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: session=SRCdeb9kLBH5sSrWkNOQiKt4dlaeBWK2; Max-Age=7776000; HttpOnly
< Location: http://dm01:8082/
< Content-Length: 0
<
* Connection #0 to host dm01 left intact

curl -b session=ufvuwYxNQWg5pjvSRTUyyHA921jwffc8 dm01:8082/nodes
// Should work fine

No comments:

Post a Comment