Sha256: 7e65fbf52f09c2a7dedb18b7935d79d98fc87c29cfcf446bca7015919cb99c92

Contents?: true

Size: 533 Bytes

Versions: 29

Compression:

Stored size: 533 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.config.token_reuse_limit
        expires_in_seconds >= threshold_limit * expires_in / 100
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
doorkeeper-5.8.0 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.7.1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.7.0 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.9 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.8 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.7 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.6 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.5 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.4 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.3 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.0 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.0.rc2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.6.0.rc1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.5.4 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.5.3 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.5.2 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.5.1 lib/doorkeeper/models/concerns/reusable.rb
doorkeeper-5.5.0 lib/doorkeeper/models/concerns/reusable.rb