Sha256: 56c765023d8da23567f430d23d3206a7dada25dcd5ab16c1dea88d11764b14ce

Contents?: true

Size: 711 Bytes

Versions: 3

Compression:

Stored size: 711 Bytes

Contents

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

module Doorkeeper
  module OAuth
    class Client
      def self.find(uid)
        if application = Doorkeeper::Application.find_by_uid(uid)
          new(application)
        end
      end

      def self.authenticate(credentials, method = Doorkeeper::Application.method(:authenticate))
        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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-0.4.2 lib/doorkeeper/oauth/client.rb
doorkeeper-0.4.1 lib/doorkeeper/oauth/client.rb
doorkeeper-0.4.0 lib/doorkeeper/oauth/client.rb