Sha256: c8ea6b2391ed9e6834db39e16ded587ed8da6d6974de6caa13761ed73334d890

Contents?: true

Size: 814 Bytes

Versions: 10

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class CodeRequest
      attr_accessor :pre_auth, :resource_owner, :client

      def initialize(pre_auth, resource_owner)
        @pre_auth       = pre_auth
        @client         = pre_auth.client
        @resource_owner = resource_owner
      end

      def authorize
        if pre_auth.authorizable?
          auth = Authorization::Code.new(pre_auth, resource_owner)
          auth.issue_token
          @response = CodeResponse.new pre_auth, auth
        else
          @response = ErrorResponse.from_request pre_auth
        end
      end

      def deny
        pre_auth.error = :access_denied
        ErrorResponse.from_request pre_auth,
                                   redirect_uri: pre_auth.redirect_uri
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
doorkeeper-5.1.2 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.0.3 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.1.1 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.2.0.rc2 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.2.0.rc1 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.1.0 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.1.0.rc2 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.1.0.rc1 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.0.2 lib/doorkeeper/oauth/code_request.rb
doorkeeper-5.0.1 lib/doorkeeper/oauth/code_request.rb