Sha256: 341ffac4bf7c7f665c800d884935720297cf8da76b3b52e598ead6ea73239594

Contents?: true

Size: 875 Bytes

Versions: 10

Compression:

Stored size: 875 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 < BaseRequest
      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

10 entries across 10 versions & 1 rubygems

Version Path
doorkeeper-4.4.3 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.4.2 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.4.1 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.4.0 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-5.0.0.rc1 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.3.2 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.3.1 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.3.0 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.2.6 lib/doorkeeper/oauth/client_credentials_request.rb
doorkeeper-4.2.5 lib/doorkeeper/oauth/client_credentials_request.rb