Sha256: 5e9af8655589581d0abd9f4f24e6c6b760aef6408fea48b4d21dd29c67d0cbb9

Contents?: true

Size: 540 Bytes

Versions: 14

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module Models
    module Reusable
      # Indicates whether the object is reusable (i.e. It is not expired and
      # has not crossed reuse_limit).
      #
      # @return [Boolean] true if can be reused and false in other case
      def reusable?
        return false if expired?
        return true unless expires_in

        threshold_limit = 100 - Doorkeeper.configuration.token_reuse_limit
        expires_in_seconds >= threshold_limit * expires_in / 100
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
doorkeeper-5.1.2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.6 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.1.1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.5 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.4 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.3 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.0 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.0.rc3 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.0.rc2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.2.0.rc1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.1.0 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.1.0.rc2 lib/doorkeeper/models/concerns/reusable.rb