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

Ship it!


Ship It!

- Jonathan Hurley


On Oct. 23, 2014, 4:55 p.m., Tom Beerbower wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27109/
> -----------------------------------------------------------
> 
> (Updated Oct. 23, 2014, 4:55 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Nate Cole.
> 
> 
> Bugs: AMBARI-7938
>     https://issues.apache.org/jira/browse/AMBARI-7938
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> When a user accesses ambari, they first "login" with a basic auth 
> "Authorization" header. That results in a AMBARISESSIONID= that is 
> authenticated. And subsequent calls from Ambari Web use that AMBARISESSIONID 
> in a cookie to avoid having to re-auth (as long as the session doesn't 
> timeout).
> If a view in ambari web is going to call-out to an ambari server (for 
> example, if the view wants to use an ambari server API to update capacity 
> scheduler configs via Ambari REST API), it would be useful for that view to 
> re-use that auth info / session so the view connects to the ambari server as 
> the "same" user.
> 
> Add a new AmbariStreamProvider that the view code can get from the view 
> context. The user specifies the path. The provider fills in the server, port 
> and protocol. The port and protocol are pulled from the Ambari config so it 
> works if SSL is configured...
>     /**
>      * Read from the input stream specified by the given path on the Ambari 
> server.
>      *
>      * @param path              the String to parse as the Ambari REST API 
> endpoint
>      * @param requestMethod     the HTTP method (GET,POST,PUT,etc.).
>      * @param params            the body of the request; may be null
>      * @param headers           the headers of the request; may be null
>      * @param useAmbariSession  indicates that the current Ambari session 
> cookie should be set for the request
>      *
>      * @return the input stream
>      *
>      * @throws java.io.IOException if an error occurred connecting to the 
> server
>      */
>     public InputStream readFrom(String path, String requestMethod, String 
> params,
>                               Map<String, String> headers, boolean 
> useAmbariSession)
>       throws IOException;
>       
> The code in the view should look something like this ...
> 
>     AmbariStreamProvider provider = context.getAmbariStreamProvider();
> 
>     InputStream stream = provider.readFrom("/api/v1/users", "GET", null, 
> null, true);
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
>  c37ee79 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
>  4a064a2 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariSessionManager.java
>  PRE-CREATION 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
>  1b57c84 
>   
> ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java
>  PRE-CREATION 
>   
> ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
>  7fea0d5 
>   ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java 
> 1f5db9a 
>   
> ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
>  PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java
>  PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java
>  PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/view/ViewContextImplTest.java
>  6bddf08 
>   
> ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java
>  PRE-CREATION 
>   ambari-views/src/main/java/org/apache/ambari/view/AmbariStreamProvider.java 
> PRE-CREATION 
>   ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java 97385d3 
> 
> Diff: https://reviews.apache.org/r/27109/diff/
> 
> 
> Testing
> -------
> 
> Manual testing.  Added new unit tests.  All existing tests pass ...
> 
> 
> Results :
> 
> Tests run: 2194, Failures: 0, Errors: 0, Skipped: 16
> 
> …
> 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 35:50.657s
> [INFO] Finished at: Thu Oct 23 15:33:40 EDT 2014
> [INFO] Final Memory: 39M/391M
> [INFO] 
> ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Tom Beerbower
> 
>

Reply via email to