Sha256: 6c238a8b1f3dced76de6bb8d6884678e96d791f8f25c120b217e1d5e7a2ea32b

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

require 'doorkeeper/oauth/client/credentials'

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-4.2.6 lib/doorkeeper/oauth/client.rb
doorkeeper-4.2.5 lib/doorkeeper/oauth/client.rb