class RubyCAS::Server::Core::Tickets::ProxyTicket

Attributes

client_hostname[RW]
consumed[RW]
created_at[RW]
id[RW]
proxy_granting_ticket[RW]
service[RW]
ticket[RW]
ticket_granting_ticket[RW]
updated_at[RW]
username[RW]

Public Class Methods

find_by_ticket(ticket) click to toggle source
# File lib/rubycas/server/memory/proxy_ticket.rb, line 26
def self.find_by_ticket(ticket)
  @storage.each do |id,pt|
    return pt if pt.ticket == ticket
  end
  return nil
end
new(pt = {}) click to toggle source
Calls superclass method
# File lib/rubycas/server/memory/proxy_ticket.rb, line 11
def initialize(pt = {})
  @id = SecureRandom.uuid
  @ticket = pt[:ticket]
  @service = pt[:service]
  @consumed = pt[:consumed]
  @client_hostname = pt[:client_hostname]
  @username = pt[:username]
  @created_at = DateTime.now
  @updated_at = DateTime.now
  @proxy_granting_ticket = pt[:proxy_granting_ticket]
  @ticket_granting_ticket = pt[:ticket_granting_ticket]
  super()
end

Public Instance Methods

consume!() click to toggle source
# File lib/rubycas/server/memory/proxy_ticket.rb, line 37
def consume!
  consumed = true
  self.save
end
consumed?() click to toggle source
# File lib/rubycas/server/memory/proxy_ticket.rb, line 33
def consumed?
  consumed
end
expired?(max_lifetime = 100) click to toggle source
# File lib/rubycas/server/memory/proxy_ticket.rb, line 42
def expired?(max_lifetime = 100)
  lifetime = Time.now.to_i - created_at.to_time.to_i
  lifetime > max_lifetime
end