Hey guys - Just wanted to throw this out there, in case it helps at all:
Here is the http header information: This is the initial get request to get the ticket id: -------------------------------------------------------------------- accept */* user-agent Ruby connection close host acp.ucsd.edu this is the response back from the get request --------------------------------------------------------------------- accept*/*user-agentRubyconnectionclosehostacp.ucsd.edu date Fri, 06 Feb 2009 19:28:39 GMT pragma no-cache expires Thu, 01 Jan 1970 00:00:00 GMT cache-control no-cache, no-store set-cookie JSESSIONID=3C7D6C51391E05350E6CEF9A9704EE00; Path=/cas; Secure content-type text/html;charset=UTF-8 content-language en-US content-length 4937 connection close dateFri, 06 Feb 2009 19:28:39 GMTpragmano-cacheexpiresThu, 01 Jan 1970 00:00:00 GMTcache-controlno-cacheno-storeset-cookieJSESSIONID=3C7D6C51391E05350E6CEF9A970 4EE00; Path=/cas; Securecontent-typetext/html;charset=UTF-8content-languageen-US content-length4937connectionclose this is me posting to login with the ticket id and user credentials ------------------------------------------------------------------------------ accept */* user-agent Ruby content-type application/x-www-form-urlencoded connection close host acp.ucsd.edu content-length 151 this is the response I get back which is the 302 temporary redirect -------------------------------------------------------------------------------- accept*/*user-agentRubycontent-typeapplication/x-www-form-urlencodedconnectioncl osehostacp.ucsd.educontent-length151 date Fri, 06 Feb 2009 19:28:39 GMT pragma no-cache expires Thu, 01 Jan 1970 00:00:00 GMT cache-control no-cache, no-store set-cookie JSESSIONID=46DCCC5CDA0A08D067B625B040AA24E0; Path=/cas; Secure location https://acp.ucsd.edu/cas/login;jsessionid=46DCCC5CDA0A08D067B625B040AA2 4E0 content-language en-US content-length 0 connection close content-type text/plain dateFri, 06 Feb 2009 19:28:39 GMTpragmano-cacheexpiresThu, 01 Jan 1970 00:00:00 GMTcache-controlno-cacheno-storeset-cookieJSESSIONID=46DCCC5CDA0A08D067B625B040A A24E0; Path=/cas; Securelocationhttps:// acp.ucsd.edu/cas/login;jsessionid=46DCCC 5CDA0A08D067B625B040AA24E0content-languageen-UScontent-length0connectionclosecon tent-typetext/plain If anyone sees something I'm missing, I'd greatly appreciate it - Thanks, Jin On Fri, Feb 6, 2009 at 10:40 AM, Jin Lee <[email protected]> wrote: > Hi Sean - > > Thanks for your reply. It didn't seem to work. However, I have dug deeper > and found some clues. > > It returns an empty string, but the http status is 302 redirect. Any idea > why this could be happening? > > Thank you, > Jin > > > On Thu, Feb 5, 2009 at 3:41 PM, Sean R. McNamara < > [email protected]> wrote: > >> Hi Jin, >> >> You may want to try to set >> >> _eventId=submit >> >> in your post. >> >> Not definitely sure this will help, but, it's worth a try. >> >> ..Sean. >> >> Jin Lee wrote: >> >>> Hi there all - >>> >>> Was wondering if you can give me a hand with a strange issue I am >>> experiencing. I am trying to login through CAS using a ruby script in order >>> to screen scrape some data on a protected webpage. >>> >>> What I did was issue a get request on login, take the lt=<ticket_id>, and >>> post to login with lt, username, and password. >>> >>> Here is the code: >>> >>> uri = URI.parse(cas_login_url) >>> http = Net::HTTP.new(uri.host, uri.port) >>> http.verify_mode = OpenSSL::SSL::VERIFY_NONE >>> http.use_ssl = true >>> req = Net::HTTP::Post.new(uri.path) >>> req.set_form_data({'lt'=>ticket, 'username'=>username, >>> 'password'=>password}) >>> res = http.request(req) >>> >>> I've logged most of the activity going on here and I am posting to the >>> correct URL, good on the ticket ID, username, and password. The response I >>> get back is simply an empty string. I'm not sure why this is happening, when >>> I issue a get request I can see the html coming in easily. >>> >>> Possible reasons: >>> Do I need to set any http header like user agent, referer, etc (I think >>> these are done for me automatically since a get request runs fine?) >>> Something to do with SSL? >>> Something to do with CAS rejecting ruby? >>> >>> Any help is greatly appreciated - >>> >>> Jin >>> -- >>> You are currently subscribed to [email protected] as: >>> [email protected] >>> To unsubscribe, change settings or access archives, see >>> http://www.ja-sig.org/wiki/display/JSG/cas-user >>> >> >> >> -- >> You are currently subscribed to [email protected] as: >> [email protected] >> To unsubscribe, change settings or access archives, see >> http://www.ja-sig.org/wiki/display/JSG/cas-user >> > > -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user
