Sha256: 142f684d79dd9460da794fba97dff0c5850c55f0b89504517d1d193e45ee1ad6

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

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

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

    has_one :proxy_granting_ticket
    belongs_to :ticket_granting_ticket

    validates :ticket, :service, :ticket_granting_ticket_id, 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/service_ticket.rb