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' => '*/*' }

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



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

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.



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

def success_body
  @success_body
end

Instance Method Details

#callObject

Executes a network request to process the CAS Service Response



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

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.



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

def 
  (@success_body)
end