Sha256: 3991a1c6e7339e0a97203db6c4d7fa8d49a5ee12f83277fab98b423e1c42315d
Contents?: true
Size: 1.3 KB
Versions: 6
Compression:
Stored size: 1.3 KB
Contents
module Castronaut module Presenters class Logout attr_reader :controller, :your_mission attr_accessor :messages delegate :params, :request, :to => :controller delegate :cookies, :env, :to => :request def initialize(controller) @controller = controller @messages = [] @your_mission = nil end def url params['url'] end def ticket_granting_ticket_cookie cookies['tgt'] end def client_host env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_HOST'] || env['REMOTE_ADDR'] end def login_ticket Castronaut::Models::LoginTicket.generate_from(client_host).ticket end def represent! ticket_granting_ticket = Castronaut::Models::TicketGrantingTicket.find_by_ticket(ticket_granting_ticket_cookie) cookies.delete 'tgt' if ticket_granting_ticket Castronaut::Models::ProxyGrantingTicket.clean_up_proxy_granting_tickets_for(ticket_granting_ticket.username) ticket_granting_ticket.destroy end messages << "You have successfully logged out." @your_mission = lambda { controller.erb :logout, :locals => { :presenter => self } } self end end end end
Version data entries
6 entries across 6 versions & 1 rubygems