0
votes

I am trying to login to a CAS server using cURL. Here is where I am so far.

I grabbed the authentication page and replaced POST with GET to see what my fields are.

file:///cas/login;jsessionid=89C2DA1B80B0C4E812F2D09CC01C05DB?username=&password=&lt=LT-2960-zIS6pxYZHdsBX7IkykfbW14oLJhdNL&execution=e1s1&_eventId=submit&submit=LOGIN

so I run

curl -k --cookie-jar dump --data "jsessionid=89C2DA1B80B0C4E812F2D09CC01C05DB?username=&password=&lt=LT-2960-zIS6pxYZHdsBX7IkykfbW14oLJhdNL&execution=e1s1&_eventId=submit&submit=LOGIN" https://CASHOST/cas/login > output

(filling out the username, password, and CASHOST obviously)

But my output is blank. If I remove the jsessionid field its also blank.

Something that is worrying me is the jsessionid field because its constantly changing.

Any ideas?

2
Ok I realize its not that simple.. but I found a resource that points me in a good direction. link Only problem is on the step with the header dump. There's no "Location" field in the header. Is anyone else able to replicate the script correctly?thecodingmate

2 Answers

1
votes

Please use curl -v. Probably you are getting 302 redirect to the login page.

I am using adopted https://gist.github.com/dodok1/4134605 which works fine for me, and maybe will work better for you.

All it needed was to add &execution=e1s1 to the call which passes the password to CAS.

My working solution is here: https://gist.github.com/gkazior/4cf7e4c38fbcbc310267

0
votes

you may need to add -L to make curl follow the redirect to CURL_DEST