Class: Cas::Client::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/cas/client/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



4
5
6
# File 'lib/cas/client/server.rb', line 4

def initialize
  @url = Cas::Client::URL.new(server_url)
end

Class Method Details

.logout_url(options = {}) ⇒ Object



24
25
26
# File 'lib/cas/client/server.rb', line 24

def self.logout_url(options={})
  new.logout_url(options).to_s
end

Instance Method Details

#login_url(options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/cas/client/server.rb', line 8

def (options={})
  if options.key?(:service_url)
    @url.append_path('/login').add_query("service=#{options[:service_url]}")
  else
    @url.append_path('/login')
  end
end

#logout_url(options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/cas/client/server.rb', line 16

def logout_url(options={})
  if options.key?(:service_url)
    @url.append_path('/logout').add_query("service=#{options[:service_url]}")
  else
    @url.append_path('/logout')
  end
end

#validate_service(service_url, ticket) ⇒ Object



28
29
30
31
32
33
# File 'lib/cas/client/server.rb', line 28

def validate_service(service_url, ticket)
  uri = Cas::Client::URL.new(validate_service_url(service_url, ticket)).to_uri
  res = Cas::Client::Response.new(uri)
  res.validate_service_response
  res.all_attributes
end