Sha256: ae306e4c279a34f8f09cbd3e0104e67412a9aaefc2beb732a20bb8515ba8d1d8

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 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 = Application.method(:by_uid))
        if (application = method.call(uid))
          new(application)
        end
      end

      def self.authenticate(credentials, method = Application.method(:by_uid_and_secret))
        return false if credentials.blank?

        if (application = method.call(credentials.uid, credentials.secret))
          new(application)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-5.0.3 lib/doorkeeper/oauth/client.rb
doorkeeper-5.0.2 lib/doorkeeper/oauth/client.rb
doorkeeper-5.0.1 lib/doorkeeper/oauth/client.rb