Class: OmniAuth::Strategies::CAS::ServiceTicketValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/strategies/cas/service_ticket_validator.rb

Constant Summary collapse

VALIDATION_REQUEST_HEADERS =
{ 'Accept' => '*/*' }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy, options, return_to_url, ticket) ⇒ ServiceTicketValidator

Build a validator from a configuration, a return_to URL, and a ticket.

Parameters:

  • options (Hash)

    the OmniAuth Strategy options

  • return_to_url (String)

    the URL of this CAS client service

  • ticket (String)

    the service ticket to validate



20
21
22
23
# File 'lib/omniauth/strategies/cas/service_ticket_validator.rb', line 20

def initialize(strategy, options, return_to_url, ticket)
  @options = options
  @uri = URI.parse(strategy.service_validate_url(return_to_url, ticket))
end

Instance Attribute Details

#success_bodyObject (readonly)

Returns the value of attribute success_body.



12
13
14
# File 'lib/omniauth/strategies/cas/service_ticket_validator.rb', line 12

def success_body
  @success_body
end

Instance Method Details

#callObject

Executes a network request to process the CAS Service Response



26
27
28
29
30
# File 'lib/omniauth/strategies/cas/service_ticket_validator.rb', line 26

def call
  @response_body = get_service_response_body
  @success_body = find_authentication_success(@response_body)
  self
end

#user_infoHash?

Request validation of the ticket from the CAS server's serviceValidate (CAS 2.0) function.

Swallows all XML parsing errors (and returns nil in those cases).

Returns:

  • (Hash, nil)

    a user information hash if the response is valid; nil otherwise.

Raises:

  • any connection errors encountered.



40
41
42
# File 'lib/omniauth/strategies/cas/service_ticket_validator.rb', line 40

def 
  (@success_body)
end