Sha256: 4ed00268bacec74567dad62cef5ee524caa7e59ac76cc2a53cca51e318af06a2

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class Client
      attr_reader :application

      delegate :id, :name, :uid, :redirect_uri, :scopes, :confidential, 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

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/oauth/client.rb
doorkeeper-5.8.0 lib/doorkeeper/oauth/client.rb
doorkeeper-5.7.1 lib/doorkeeper/oauth/client.rb