Sha256: c1ed3b4eac63183e844dff01cfbcf68a8f80423e1e29d5e988d0a3e446785b32

Contents?: true

Size: 863 Bytes

Versions: 13

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    module Helpers
      module UniqueToken
        def self.generate(options = {})
          # Access Token value must be 1*VSCHAR or
          # 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
          #
          # @see https://tools.ietf.org/html/rfc6749#appendix-A.12
          # @see https://tools.ietf.org/html/rfc6750#section-2.1
          #
          generator_method = options.delete(:generator) || SecureRandom.method(self.generator_method)
          token_size       = options.delete(:size)      || 32
          generator_method.call(token_size)
        end

        # Generator method for default generator class (SecureRandom)
        #
        def self.generator_method
          Doorkeeper.configuration.default_generator_method
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
doorkeeper-5.1.2 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.6 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.1.1 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.5 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.4 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.3 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.2 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.1 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.0 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.0.rc3 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.0.rc2 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.2.0.rc1 lib/doorkeeper/oauth/helpers/unique_token.rb
doorkeeper-5.1.0 lib/doorkeeper/oauth/helpers/unique_token.rb