Class: RubyCAS::Server::Core::Tickets::ProxyTicket
- Defined in:
- lib/rubycas/server/memory/proxy_ticket.rb
Instance Attribute Summary collapse
-
#client_hostname ⇒ Object
Returns the value of attribute client_hostname.
-
#consumed ⇒ Object
Returns the value of attribute consumed.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#proxy_granting_ticket ⇒ Object
Returns the value of attribute proxy_granting_ticket.
-
#service ⇒ Object
Returns the value of attribute service.
-
#ticket ⇒ Object
Returns the value of attribute ticket.
-
#ticket_granting_ticket ⇒ Object
Returns the value of attribute ticket_granting_ticket.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #consume! ⇒ Object
- #consumed? ⇒ Boolean
- #expired?(max_lifetime = 100) ⇒ Boolean
-
#initialize(pt = {}) ⇒ ProxyTicket
constructor
A new instance of ProxyTicket.
Methods inherited from Storage
Constructor Details
#initialize(pt = {}) ⇒ ProxyTicket
Returns a new instance of ProxyTicket.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 11 def initialize(pt = {}) @id = SecureRandom.uuid @ticket = pt[:ticket] @service = pt[:service] @consumed = pt[:consumed] @client_hostname = pt[:client_hostname] @username = pt[:username] @created_at = DateTime.now @updated_at = DateTime.now @proxy_granting_ticket = pt[:proxy_granting_ticket] @ticket_granting_ticket = pt[:ticket_granting_ticket] super() end |
Instance Attribute Details
#client_hostname ⇒ Object
Returns the value of attribute client_hostname.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def client_hostname @client_hostname end |
#consumed ⇒ Object
Returns the value of attribute consumed.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def consumed @consumed end |
#created_at ⇒ Object
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def id @id end |
#proxy_granting_ticket ⇒ Object
Returns the value of attribute proxy_granting_ticket.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def proxy_granting_ticket @proxy_granting_ticket end |
#service ⇒ Object
Returns the value of attribute service.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def service @service end |
#ticket ⇒ Object
Returns the value of attribute ticket.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def ticket @ticket end |
#ticket_granting_ticket ⇒ Object
Returns the value of attribute ticket_granting_ticket.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def ticket_granting_ticket @ticket_granting_ticket end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def updated_at @updated_at end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 7 def username @username end |
Class Method Details
.find_by_ticket(ticket) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 26 def self.find_by_ticket(ticket) @storage.each do |id,pt| return pt if pt.ticket == ticket end return nil end |
Instance Method Details
#consume! ⇒ Object
37 38 39 40 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 37 def consume! consumed = true self.save end |
#consumed? ⇒ Boolean
33 34 35 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 33 def consumed? consumed end |
#expired?(max_lifetime = 100) ⇒ Boolean
42 43 44 45 |
# File 'lib/rubycas/server/memory/proxy_ticket.rb', line 42 def expired?(max_lifetime = 100) lifetime = Time.now.to_i - created_at.to_time.to_i lifetime > max_lifetime end |