Class: RackCAS::Server

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

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Server


7
8
9
# File 'lib/rack-cas/server.rb', line 7

def initialize(url)
  @url = RackCAS::URL.parse(url)
end

Instance Method Details

#login_url(service_url, params = {}) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/rack-cas/server.rb', line 11

def (service_url, params = {})
  service_url = URL.parse(service_url).to_s
  base_params = {service: service_url}
  base_params[:renew] = true if RackCAS.config.renew?

  url = RackCAS.config. ? RackCAS::URL.parse(RackCAS.config.) : @url.dup.append_path('login')
  url.add_params(base_params.merge(params))
end

#logout_url(params = {}) ⇒ Object


20
21
22
23
24
25
# File 'lib/rack-cas/server.rb', line 20

def logout_url(params = {})
  @url.dup.tap do |url|
    url.append_path('logout')
    url.add_params(params) unless params.empty?
  end
end

#validate_service(service_url, ticket) ⇒ Object


27
28
29
30
31
32
33
34
# File 'lib/rack-cas/server.rb', line 27

def validate_service(service_url, ticket)
  unless RackCAS.config.use_saml_validation?
    response = ServiceValidationResponse.new validate_service_url(service_url, ticket)
  else
    response = SAMLValidationResponse.new saml_validate_url(service_url), ticket
  end
  [response.user, response.extra_attributes]
end