Class: CASinoCore::Processor::ProxyTicketProvider

Inherits:
CASinoCore::Processor show all
Includes:
Helper::ProxyGrantingTickets, Helper::ProxyTickets
Defined in:
lib/casino_core/processor/proxy_ticket_provider.rb

Overview

The ProxyTicketProvider processor should be used to handle GET requests to /proxy

Constant Summary

Constants included from Helper::Tickets

Helper::Tickets::ALLOWED_TICKET_STRING_CHARACTERS

Instance Method Summary collapse

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 included from Helper::ProxyGrantingTickets

#acquire_proxy_granting_ticket

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 #request_succeeded or #request_failed. In both cases, it supplies a string as argument. The web application should present that string (and nothing else) to the requestor. The Content-Type should be set to ‘text/xml; charset=utf-8’

Parameters:

  • params (Hash) (defaults to: nil)

    parameters delivered by the client



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/casino_core/processor/proxy_ticket_provider.rb', line 16

def process(params = nil)
  if params[:pgt].nil? || params[:targetService].nil?
    @listener.request_failed build_xml false, error_code: 'INVALID_REQUEST', error_message: '"pgt" and "targetService" parameters are both required'
  else
    proxy_granting_ticket = CASinoCore::Model::ProxyGrantingTicket.where(ticket: params[:pgt]).first
    if proxy_granting_ticket.nil?
      @listener.request_failed build_xml false, error_code: 'BAD_PGT', error_message: 'PGT not found'
    else
      proxy_ticket = acquire_proxy_ticket(proxy_granting_ticket, params[:targetService])
      @listener.request_succeeded build_xml true, proxy_ticket: proxy_ticket
    end
  end
end