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

Jesus Alvarez commented on KNOX-1321:
-------------------------------------

Hey Kevin,

After taking a closer look.. Adding the batches route would benefit from 
https://issues.apache.org/jira/browse/KNOX-1098 being completed first. The 
current rewrite rule may be insufficient to replace proxyUser content is 
insufficient in covering all scenarios (such as if proxyUser is not present). 

 

Once 1098 adds a dispatch class for livy to add proxyUser to the payload with 
correct content, then batches should be added including that same dispatch class

> Livy service.xml does not apply addusername rule to /batches endpoint
> ---------------------------------------------------------------------
>
>                 Key: KNOX-1321
>                 URL: https://issues.apache.org/jira/browse/KNOX-1321
>             Project: Apache Knox
>          Issue Type: Bug
>    Affects Versions: 0.14.0
>            Reporter: Jesus Alvarez
>            Assignee: Jesus Alvarez
>            Priority: Major
>
> When a request is made to Livy via Knox today:
> 1, Spark Magic sends a JSON body to knox, ex: 
> {"driverMemory":"2G","executorCores":4,"executorMemory":"8G","proxyUser":"alice"}
> 2, Knox's service.xml will rewrite the proxyUser "alice" to the actual 
> authenticated username:
>  
> {code:java}
> <route path="/livy/v1/sessions">
> <rewrite apply="LIVYSERVER/livy/addusername/inbound" to="request.body"/>
> </route>
> <route path="/livy/v1/**?**"/>
> <route path="/livy/v1"/>
> <route path="/livy/v1/"/>{code}
>  
>  
> Using the rewrite.xml rules:
>  
> {code:java}
> <rule name="LIVYSERVER/livy/user-name">
>  <rewrite template="{$username}"/>
> </rule>
> <filter name="LIVYSERVER/livy/addusername/inbound">
>  <content type="*/json">
>  <apply path="$.proxyUser" rule="LIVYSERVER/livy/user-name"/>
>  </content>
> </filter>
> {code}
>  
>  
>  The issue here is that requests made to 
> *knox:port/gateway/topology/livy/v1/batches* will not apply the same rewrite 
> rule. 
>  
>  
> https://livy.incubator.apache.org/docs/latest/rest-api.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to