Sha256: cf6c46723963c0f0c60b3f741708d4ef5def3fbbde2d6b18897c71b78eba29ec

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class Client
      attr_accessor :application

      delegate :id, :name, :uid, :redirect_uri, :scopes, to: :@application

      def initialize(application)
        @application = application
      end

      def self.find(uid, method = Doorkeeper.config.application_model.method(:by_uid))
        return unless (application = method.call(uid))

        new(application)
      end

      def self.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret))
        return if credentials.blank?
        return unless (application = method.call(credentials.uid, credentials.secret))

        new(application)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doorkeeper-5.3.3 lib/doorkeeper/oauth/client.rb
doorkeeper-5.3.2 lib/doorkeeper/oauth/client.rb
doorkeeper-5.3.1 lib/doorkeeper/oauth/client.rb
doorkeeper-5.3.0 lib/doorkeeper/oauth/client.rb