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

Reply via email to