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