Class: OmniAuth::Strategies::CAS3::ServiceTicketValidator

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

Constant Summary collapse

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

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



17
18
19
20
# File 'lib/omniauth/strategies/cas3/service_ticket_validator.rb', line 17

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

Instance Method Details

#callObject

Executes a network request to process the CAS Service Response



23
24
25
26
27
# File 'lib/omniauth/strategies/cas3/service_ticket_validator.rb', line 23

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.



37
38
39
# File 'lib/omniauth/strategies/cas3/service_ticket_validator.rb', line 37

def 
  (@success_body)
end