Sha256: 5be1ef70c53be41286d43c0ba537d3fc90077d4b379e848b9a0052da26ffc9e8

Contents?: true

Size: 758 Bytes

Versions: 6

Compression:

Stored size: 758 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, :scopes, to: :@application

      def initialize(application)
        @application = application
      end

      attr_accessor :application
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
doorkeeper-2.2.0 lib/doorkeeper/oauth/client.rb
doorkeeper-2.1.4 lib/doorkeeper/oauth/client.rb
doorkeeper-2.1.3 lib/doorkeeper/oauth/client.rb
doorkeeper-2.1.2 lib/doorkeeper/oauth/client.rb
doorkeeper-2.1.1 lib/doorkeeper/oauth/client.rb
doorkeeper-2.1.0 lib/doorkeeper/oauth/client.rb