Sha256: 488d117ef445c68d9db6f874886b2d6f7ab969f949277614933f745ed1ec7548

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module RubyCAS
  module Server
    module Core
      module Tickets
        class ProxyGrantingTicket < Storage

          attr_accessor :id, :ticket, :client_hostname, :iou,
                        :created_at, :updated_at, :service_ticket,
                        :proxy_tickets

          def initialize(pgt = {})
            @id = SecureRandom.uuid
            @ticket = pgt[:ticket]
            @client_hostname = pgt[:client_hostname]
            @created_at = DateTime.now
            @updated_at = DateTime.now
            @service_ticket = pgt[:service_ticket]
            @proxy_tickets = pgt[:proxy_tickets]
            super()
          end


          def self.find_by_ticket(ticket)
            @storage.each do |id,pgt|
              return pgt if pgt.ticket == ticket
            end
            return nil
          end

          def expired?(max_lifetime = 100)
            lifetime = Time.now.to_i - created_at.to_time.to_i
            lifetime > max_lifetime
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubycas-server-memory-0.0.2 lib/rubycas/server/memory/proxy_granting_ticket.rb
rubycas-server-memory-0.0.1 lib/rubycas/server/memory/proxy_granting_ticket.rb