Sha256: 4cc0315790c8bddd480d69ff294328b641eb3ebeba5ba2130c3f12945418f23d

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require 'rubycas/server/activerecord/model/ticket'
require 'rubycas/server/activerecord/model/consumable'

module RubyCAS::Server::Core::Tickets
  class LoginTicket < ActiveRecord::Base
    include RubyCAS::Server::Core::Ticket
    #include RubyCAS::Server::Core::Consumable


    validates :ticket, :client_hostname, presence: true

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

    def consume!
      consumed = true
      self.save
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubycas-server-activerecord-0.0.1 lib/rubycas/server/activerecord/model/login_ticket.rb