> On April 7, 2015, 12:43 a.m., Tom Beerbower wrote:
> > ambari-server/src/test/java/org/apache/ambari/server/view/HttpImpersonatorImplTest.java,
> >  line 128
> > <https://reviews.apache.org/r/32804/diff/2/?file=914981#file914981line128>
> >
> >     How come I don't see a change for FALCON_AMBARI_VIEW in 
> > HttpImpersonator?
> >     
> >     Also, we can't do this.  The view framework can't have knowledge of 
> > specific views.  Why do these changes only apply to Falcon?
> 
> Alejandro Fernandez wrote:
>     The Falcon team needed to use "user.name=john" instead of "doAs=john", so 
> that's why this started as a Falcon-related request. Given that that these 
> classes are deprecated, I will recommend for them to use 
> ViewURLStreamProvider.readAsCurrent()
> 
> Tom Beerbower wrote:
>     Could they just use URLStreamProvider.readFrom() (which doesn't set doAs) 
> and pass "user.name=john" in the headers?  If so then no changes are required.
> 
> Alejandro Fernandez wrote:
>     Sure, I'll abandon this patch and inform them.

Cool, thanks!

Something like this for the current user ...

      
      URLStreamProvider streamProvider = viewContext.getURLStreamProvider();
      
      String url = ...;
      String body = ...;
      String name = viewContext.getUsername();

      Map<String, String> headers = Collections.singletonMap("user.name", 
name); 
      
      InputStream stream = streamProvider.readFrom(url, "GET", body, headers);


- Tom


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/32804/#review79095
-----------------------------------------------------------


On April 3, 2015, 10:55 p.m., Alejandro Fernandez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32804/
> -----------------------------------------------------------
> 
> (Updated April 3, 2015, 10:55 p.m.)
> 
> 
> Review request for Ambari, Sumit Mohanty, Tom Beerbower, Venkat Ranganathan, 
> and Yusaku Sako.
> 
> 
> Bugs: AMBARI-10341
>     https://issues.apache.org/jira/browse/AMBARI-10341
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Falcon View needs to use the HttpImpersonator interface in Ambari Views so it 
> can proxy using the header user.name
> 
> HttpImpersonatorImpl.java should only allow this if the request headers 
> indicate it is for the Falcon View.
> 
> 
> Diffs
> -----
> 
>   ambari-server/pom.xml 896a202 
>   
> ambari-server/src/main/java/org/apache/ambari/server/view/HttpImpersonatorImpl.java
>  fe4e180 
>   
> ambari-server/src/test/java/org/apache/ambari/server/view/HttpImpersonatorImplTest.java
>  935b488 
>   ambari-views/pom.xml 8fcb5ae 
>   ambari-views/src/main/java/org/apache/ambari/view/HttpImpersonator.java 
> 02ce101 
>   ambari-views/src/main/java/org/apache/ambari/view/ImpersonatorResponse.java 
> PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/32804/diff/
> 
> 
> Testing
> -------
> 
> Ran local unit tests in HttpImpersonatorImplTest.java passed.
> 
> 
> Thanks,
> 
> Alejandro Fernandez
> 
>

Reply via email to