Class: CASinoCore::Processor::OtherSessionsDestroyer

Inherits:
CASinoCore::Processor show all
Includes:
Helper::TicketGrantingTickets
Defined in:
lib/casino_core/processor/other_sessions_destroyer.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 Helper::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 Helper::Logger

#logger

Methods included from Helper::Browser

#browser_info, #same_browser?

Methods inherited from CASinoCore::Processor

#initialize

Constructor Details

This class inherits a constructor from CASinoCore::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



20
21
22
23
24
25
26
27
28
29
# File 'lib/casino_core/processor/other_sessions_destroyer.rb', line 20

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