Sha256: 4f88850fbce46d6b4a774c8aa5eb9312b6dd6e1c679061508b032b5779940bb0
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module RubyCAS module Server module Core module Tickets class LoginTicket < Storage attr_accessor :id, :ticket, :consumed, :client_hostname, :created_at, :updated_at 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 def self.find_by_ticket(ticket) @storage.each do |id,lt| return lt if lt.ticket == ticket end return nil end def consumed? consumed end def consume! self.consumed = true self.save 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/login_ticket.rb |
rubycas-server-memory-0.0.1 | lib/rubycas/server/memory/login_ticket.rb |