Class: CASino::OtherSessionsDestroyerProcessor

Inherits:
Processor
  • Object
show all
Includes:
ProcessorConcern::TicketGrantingTickets
Defined in:
app/processors/casino/other_sessions_destroyer_processor.rb

Overview

The OtherSessionsDestroyer processor should be used to process GET requests to /destroy-other-sessions.

It is usefule to redirect users to this action after a password change.

This feature is not described in the CAS specification so it’s completly optional to implement this on the web application side.

Instance Method Summary collapse

Methods included from ProcessorConcern::TicketGrantingTickets

#acquire_ticket_granting_ticket, #cleanup_expired_ticket_granting_tickets, #find_valid_ticket_granting_ticket, #load_or_initialize_user, #remove_ticket_granting_ticket

Methods included from ProcessorConcern::Browser

#browser_info, #same_browser?

Methods inherited from Processor

#initialize

Constructor Details

This class inherits a constructor from CASino::Processor

Instance Method Details

#process(params = nil, cookies = nil, user_agent = nil) ⇒ Object

This method will call ‘#other_sessions_destroyed` and may supply an URL that should be presented to the user. The user should be redirected to this URL immediately.

Parameters:

  • params (Hash) (defaults to: nil)

    parameters supplied by user

  • cookies (Hash) (defaults to: nil)

    cookies supplied by user

  • user_agent (String) (defaults to: nil)

    user-agent delivered by the client



16
17
18
19
20
21
22
23
24
25
# File 'app/processors/casino/other_sessions_destroyer_processor.rb', line 16

def process(params = nil, cookies = nil, user_agent = nil)
  params ||= {}
  cookies ||= {}
  tgt = find_valid_ticket_granting_ticket(cookies[:tgt], user_agent)
  unless tgt.nil?
    other_ticket_granting_tickets = tgt.user.ticket_granting_tickets.where('id != ?', tgt.id)
    other_ticket_granting_tickets.destroy_all
  end
  @listener.other_sessions_destroyed(params[:service])
end