Sha256: 3f28f13469e671cc221036762d7c9baf7cdb259634eaace717d029faece2e13c

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-5.0.0 lib/doorkeeper/oauth/client.rb
doorkeeper-5.0.0.rc2 lib/doorkeeper/oauth/client.rb