Sha256: 2b47fc2427c395929867398824fbdb35914a6ee805fd4ada4f70acdaeea2183f
Contents?: true
Size: 1.34 KB
Versions: 14
Compression:
Stored size: 1.34 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' controller.delete_cookie('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
14 entries across 14 versions & 3 rubygems