Sha256: ac3726c41f97ed55e921ebcf4f0f4f367eb43eb1d3ac26a116405e09bfb04f22

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 Bytes

Contents

require 'doorkeeper/oauth/client_credentials/creator'
require 'doorkeeper/oauth/client_credentials/issuer'
require 'doorkeeper/oauth/client_credentials/validation'

module Doorkeeper
  module OAuth
    class ClientCredentialsRequest
      include Validations
      include OAuth::RequestConcern

      attr_accessor :server, :client, :original_scopes
      attr_reader :response
      attr_writer :issuer

      alias_method :error_response, :response

      delegate :error, to: :issuer

      def issuer
        @issuer ||= Issuer.new(server, Validation.new(server, self))
      end

      def initialize(server, client, parameters = {})
        @client = client
        @server = server
        @response = nil
        @original_scopes = parameters[:scope]
      end

      def access_token
        issuer.token
      end

      private

      def valid?
        issuer.create(client, scopes)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doorkeeper-4.2.0 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.1.0 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.0.0 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.0.0.rc4 lib/doorkeeper/oauth/client_credentials_request.rb