Class: RubyCAS::Server::Core::Tickets::ProxyGrantingTicket

Inherits:
Storage
  • Object
show all
Defined in:
lib/rubycas/server/memory/proxy_granting_ticket.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Storage

#save, #save!

Constructor Details

#initialize(pgt = {}) ⇒ ProxyGrantingTicket

Returns a new instance of ProxyGrantingTicket.



11
12
13
14
15
16
17
18
19
20
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 11

def initialize(pgt = {})
  @id = SecureRandom.uuid
  @ticket = pgt[:ticket]
  @client_hostname = pgt[:client_hostname]
  @created_at = DateTime.now
  @updated_at = DateTime.now
  @service_ticket = pgt[:service_ticket]
  @proxy_tickets = pgt[:proxy_tickets]
  super()
end

Instance Attribute Details

#client_hostnameObject

Returns the value of attribute client_hostname.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def client_hostname
  @client_hostname
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def id
  @id
end

#iouObject

Returns the value of attribute iou.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def iou
  @iou
end

#proxy_ticketsObject

Returns the value of attribute proxy_tickets.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def proxy_tickets
  @proxy_tickets
end

#service_ticketObject

Returns the value of attribute service_ticket.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def service_ticket
  @service_ticket
end

#ticketObject

Returns the value of attribute ticket.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def ticket
  @ticket
end

#updated_atObject

Returns the value of attribute updated_at.



7
8
9
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 7

def updated_at
  @updated_at
end

Class Method Details

.find_by_ticket(ticket) ⇒ Object



23
24
25
26
27
28
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 23

def self.find_by_ticket(ticket)
  @storage.each do |id,pgt|
    return pgt if pgt.ticket == ticket
  end
  return nil
end

Instance Method Details

#expired?(max_lifetime = 100) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/rubycas/server/memory/proxy_granting_ticket.rb', line 30

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