Sha256: fba603b366d7b5ee7b09867cabfa70d7560a558c6452543f74cd9636477aca99

Contents?: true

Size: 1007 Bytes

Versions: 31

Compression:

Stored size: 1007 Bytes

Contents

module Doorkeeper
  module OAuth
    class TokenRequest
      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::Token.new(pre_auth, resource_owner)
          auth.issue_token
          @response = CodeResponse.new pre_auth,
                                       auth,
                                       response_on_fragment: true
        else
          @response = error_response
        end
      end

      def deny
        pre_auth.error = :access_denied
        error_response
      end

      private

      def error_response
        ErrorResponse.from_request pre_auth,
                                   redirect_uri: pre_auth.redirect_uri,
                                   response_on_fragment: true
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
doorkeeper-4.2.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.1.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.0.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.0.0.rc4 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.0.0.rc3 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.0.0.rc2 lib/doorkeeper/oauth/token_request.rb
doorkeeper-4.0.0.rc1 lib/doorkeeper/oauth/token_request.rb
doorkeeper-3.1.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-3.0.1 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.2.2 lib/doorkeeper/oauth/token_request.rb
doorkeeper-3.0.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-3.0.0.rc2 lib/doorkeeper/oauth/token_request.rb
doorkeeper-3.0.0.rc1 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.2.1 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.2.0 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.1.4 lib/doorkeeper/oauth/token_request.rb
doorkeeper-1.4.2 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.1.3 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.1.2 lib/doorkeeper/oauth/token_request.rb
doorkeeper-2.1.1 lib/doorkeeper/oauth/token_request.rb