Object
Represents a response from the CAS server to a login request (i.e. after submitting a username/password).
# File lib/casclient/responses.rb, line 213 def is_failure? @failure == true end
# File lib/casclient/responses.rb, line 209 def is_success? !@failure && !ticket.blank? end
# File lib/casclient/responses.rb, line 179 def parse_http_response(http_response) header = http_response.to_hash # FIXME: this regexp might be incorrect... if header['set-cookie'] && header['set-cookie'].first && header['set-cookie'].first =~ /tgt=([^&]+);/ @tgt = $~[1] end location = header['location'].first if header['location'] && header['location'].first if location =~ /ticket=([^&]+)/ @ticket = $~[1] end if not ((http_response.kind_of?(Net::HTTPSuccess) || http_response.kind_of?(Net::HTTPFound)) && @ticket.present?) @failure = true # Try to extract the error message -- this only works with RubyCAS-Server. # For other servers we just return the entire response body (i.e. the whole error page). body = http_response.body if body =~ /<div class="messagebox mistake">(.*?)<\/div>/ @failure_message = $~[1].strip else @failure_message = body end end @service_redirect_url = location end
Generated with the Darkfish Rdoc Generator 2.