Sha256: 88d9090147a4521d4f06e3aea02ba663fb0a111c577c77cc51a3196e47127d2b

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

module Castronaut
  module Presenters

    class Logout < Base
      def url
        params['url']
      end

      def ticket_granting_ticket_cookie
        cookies['tgt']
      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.identifier)
          ticket_granting_ticket.destroy
        end
        
        messages << "You have successfully logged out."
        
        @your_mission = { :template => :logout }
                
        self
      end
    
    end

  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
3mix-castronaut-0.5.0.2 lib/castronaut/presenters/logout.rb