Sha256: 5eedad49e54194a09f36ff3e54695ebb17315798a4a82aad43ed7fd821ee99ce

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 Bytes

Contents

require 'doorkeeper/oauth/client/methods'
require 'doorkeeper/oauth/client/credentials'

module Doorkeeper
  module OAuth
    class Client
      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

      delegate :id, :name, :uid, :redirect_uri, to: :@application

      def initialize(application)
        @application = application
      end

      attr_accessor :application
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
doorkeeper-2.0.1 lib/doorkeeper/oauth/client.rb
doorkeeper-2.0.0 lib/doorkeeper/oauth/client.rb
doorkeeper-2.0.0.rc3 lib/doorkeeper/oauth/client.rb
doorkeeper-2.0.0.rc2 lib/doorkeeper/oauth/client.rb
doorkeeper-2.0.0.alpha1 lib/doorkeeper/oauth/client.rb