class RubyCAS::Server::Core::Tickets::LoginTicket

Attributes

client_hostname[RW]
consumed[RW]
created_at[RW]
id[RW]
ticket[RW]
updated_at[RW]

Public Class Methods

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

Public Instance Methods

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