Class: Casablanca::CommandLineClient

Inherits:
Client
  • Object
show all
Defined in:
lib/casablanca/client.rb

Instance Attribute Summary collapse

Attributes inherited from Client

#cas_server_url, #service_url

Instance Method Summary collapse

Methods inherited from Client

#authenticate_ticket, #initialize, #logger, logger, logger=, #logger=, #login_url, #logout_url, #validate_url

Constructor Details

This class inherits a constructor from Casablanca::Client

Instance Attribute Details

#ticket_granting_ticketObject (readonly)

Returns the value of attribute ticket_granting_ticket.



125
126
127
# File 'lib/casablanca/client.rb', line 125

def ticket_granting_ticket
  @ticket_granting_ticket
end

Instance Method Details

#login(username, password) ⇒ Object

Logs in to the CAS server and returns the response



128
129
130
131
132
133
# File 'lib/casablanca/client.rb', line 128

def (username, password)
  @ticket_granting_ticket = nil
  response = post(URI.parse(), {:username => username, :password => password, :service => service_url})
  set_ticket_granting_ticket(response)
  get_service_ticket(response)
end

#logout(follow_url = nil) ⇒ Object



135
136
137
138
139
140
# File 'lib/casablanca/client.rb', line 135

def logout(follow_url=nil)
  @ticket_granting_ticket = nil
  uri = URI.parse(logout_url)
  uri.merge_query(:url => follow_url) if follow_url
  get(uri)
end