Class: CASinoCore::Processor::LegacyValidator

Inherits:
CASinoCore::Processor show all
Includes:
Helper::Logger, Helper::ServiceTickets
Defined in:
lib/casino_core/processor/legacy_validator.rb

Overview

The LegacyValidator processor should be used for GET requests to /validate

Constant Summary

Constants included from Helper::ServiceTickets

Helper::ServiceTickets::RESERVED_CAS_PARAMETER_KEYS

Constants included from Helper::Tickets

Helper::Tickets::ALLOWED_TICKET_STRING_CHARACTERS

Instance Method Summary collapse

Methods included from Helper::ServiceTickets

#acquire_service_ticket, #clean_service_url

Methods included from Helper::ProxyTickets

#acquire_proxy_ticket, #ticket_valid_for_service?, #validate_ticket_for_service

Methods included from Helper::Tickets

#random_ticket_string

Methods included from Helper::Logger

#logger

Methods inherited from CASinoCore::Processor

#initialize

Constructor Details

This class inherits a constructor from CASinoCore::Processor

Instance Method Details

#process(params = nil) ⇒ Object

This method will call #validation_succeeded or #validation_failed. In both cases, it supplies a string as argument. The web application should present that string (and nothing else) to the requestor.

Parameters:

  • params (Hash) (defaults to: nil)

    parameters supplied by requestor (a service)



15
16
17
18
19
20
21
22
23
# File 'lib/casino_core/processor/legacy_validator.rb', line 15

def process(params = nil)
  params ||= {}
  ticket = CASinoCore::Model::ServiceTicket.where(ticket: params[:ticket]).first
  if !params[:service].nil? && ticket_valid_for_service?(ticket, params[:service], !!params[:renew])
    @listener.validation_succeeded("yes\n#{ticket.ticket_granting_ticket.user.username}\n")
  else
    @listener.validation_failed("no\n\n")
  end
end