Module: CASino::ProcessorConcern::Tickets
- Included in:
- LoginTickets, ProxyGrantingTickets, ProxyTickets, ServiceTickets
- Defined in:
- app/processors/casino/processor_concern/tickets.rb
Constant Summary collapse
- ALLOWED_TICKET_STRING_CHARACTERS =
('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a
Instance Method Summary collapse
Instance Method Details
#random_ticket_string(prefix, length = 40) ⇒ Object
9 10 11 12 13 14 |
# File 'app/processors/casino/processor_concern/tickets.rb', line 9 def random_ticket_string(prefix, length = 40) random_string = SecureRandom.random_bytes(length).each_char.map do |char| ALLOWED_TICKET_STRING_CHARACTERS[(char.ord % ALLOWED_TICKET_STRING_CHARACTERS.length)] end.join "#{prefix}-#{'%d' % (Time.now.to_f * 10000)}-#{random_string}" end |