You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Shi Wang (JIRA)" <ji...@apache.org> on 2017/05/22 23:55:04 UTC

[jira] [Comment Edited] (KNOX-931) asType will not work for body filter when using IdentityAsserterFilter

    [ https://issues.apache.org/jira/browse/KNOX-931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16020424#comment-16020424 ] 

Shi Wang edited comment on KNOX-931 at 5/22/17 11:54 PM:
---------------------------------------------------------

[~lmccay@apache.org] Sorry I didnt make it clear in the description.

The use case is:
if I add the following in rewrite.xml
<filter name="somename">
        <content type="application/x-www-form-urlencoded" asType="application/json">
        </content>
    </filter>

and in the service.xml I apply this filter to the request body such as
<rewrite apply="somename" to="request.body"/>

And when do curl command without specifying the content-type header, it will by default using application/x-www-form-urlencoded to encode the request body. But I intend to use application/json to encode the request body just like defined in the rewrite asType rule. 

But in the IdentityAsserterHttpServletsWrapper.java, it will overwrite the correctly encode request body with urlencoded method, which makes the rewrite rule invalid.

In this case the server may not understand the urlencoded request body with the present of %, because it is expecting a json formatted payload


was (Author: wancy):
[~lmccay@apache.org] Sorry I didnt make it clear in the description.

The use case is:
if I add the following in rewrite.xml
<filter name="somename">
        <content type="application/x-www-form-urlencoded" asType="application/json">
        </content>
    </filter>

and in the service.xml I apply this filter to the request body such as
<rewrite apply="somename" to="request.body"/>

And when do curl command without specifying the content-type header, it will by default using application/x-www-form-urlencoded to encode the request body. But I intend to use application/json to encode the request body just like defined in the rewrite asType rule. 

But in the IdentityAsserterHttpServletsWrapper.java, it will overwrite the correctly encode request body with urlencoded method, which makes the rewrite rule invalid.

> asType will not work for body filter when using IdentityAsserterFilter
> ----------------------------------------------------------------------
>
>                 Key: KNOX-931
>                 URL: https://issues.apache.org/jira/browse/KNOX-931
>             Project: Apache Knox
>          Issue Type: Bug
>    Affects Versions: 0.11.0
>            Reporter: Shi Wang
>            Assignee: Shi Wang
>             Fix For: 0.13.0
>
>         Attachments: 0001-KNOX-931-asType-will-not-work-for-body-filter-when-u.patch
>
>
> In IdentityAsserterHttpServletsWrapper.java, method getInputStream(),
> The body will always be urlEncoded if the contentType is "application/x-www-form-urlencoded"
> And self defined filter that change "application/x-www-form-urlencoded" as other contentType for requestbody will be invalid.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)