Sha256: 03f9bf88ee34ff71709413f91b37b287a4b7c06c8daba2202c4b0c6edf747d05

Contents?: true

Size: 759 Bytes

Versions: 14

Compression:

Stored size: 759 Bytes

Contents

require 'doorkeeper/oauth/client/methods'
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

14 entries across 14 versions & 1 rubygems

Version Path
doorkeeper-4.2.0 lib/doorkeeper/oauth/client.rb
doorkeeper-4.1.0 lib/doorkeeper/oauth/client.rb
doorkeeper-4.0.0 lib/doorkeeper/oauth/client.rb
doorkeeper-4.0.0.rc4 lib/doorkeeper/oauth/client.rb
doorkeeper-4.0.0.rc3 lib/doorkeeper/oauth/client.rb
doorkeeper-4.0.0.rc2 lib/doorkeeper/oauth/client.rb
doorkeeper-4.0.0.rc1 lib/doorkeeper/oauth/client.rb
doorkeeper-3.1.0 lib/doorkeeper/oauth/client.rb
doorkeeper-3.0.1 lib/doorkeeper/oauth/client.rb
doorkeeper-2.2.2 lib/doorkeeper/oauth/client.rb
doorkeeper-3.0.0 lib/doorkeeper/oauth/client.rb
doorkeeper-3.0.0.rc2 lib/doorkeeper/oauth/client.rb
doorkeeper-3.0.0.rc1 lib/doorkeeper/oauth/client.rb
doorkeeper-2.2.1 lib/doorkeeper/oauth/client.rb