Sha256: f42caed20d83096495a3ad8c4b9d4ab60c5e576ae3d53694a12f319f10980ef3

Contents?: true

Size: 855 Bytes

Versions: 15

Compression:

Stored size: 855 Bytes

Contents

module CASino
  module ProcessorConcern
    module LoginTickets
      include CASino::ProcessorConcern::Tickets

      def acquire_login_ticket
        ticket = CASino::LoginTicket.create ticket: random_ticket_string('LT')
        Rails.logger.debug "Created login ticket '#{ticket.ticket}'"
        ticket
      end

      def login_ticket_valid?(lt)
        ticket = CASino::LoginTicket.find_by_ticket lt
        if ticket.nil?
          Rails.logger.info "Login ticket '#{lt}' not found"
          false
        elsif ticket.created_at < CASino.config.login_ticket[:lifetime].seconds.ago
          Rails.logger.info "Login ticket '#{ticket.ticket}' expired"
          false
        else
          Rails.logger.debug "Login ticket '#{ticket.ticket}' successfully validated"
          ticket.delete
          true
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
casino-3.0.4 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.7 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.3 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.2 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.1 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.0 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.0.pre.2 app/processors/casino/processor_concern/login_tickets.rb
casino-3.0.0.pre.1 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.6 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.5 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.4 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.3 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.2 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.1 app/processors/casino/processor_concern/login_tickets.rb
casino-2.0.0 app/processors/casino/processor_concern/login_tickets.rb