Sha256: a80ff86bc1f65daefe3f2698c32248f459ada5f63dc14f21827f4948e04d259b

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 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

1 entries across 1 versions & 1 rubygems

Version Path
doorkeeper-5.1.0.rc2 lib/doorkeeper/oauth/helpers/unique_token.rb