org.apache.ambari.view
Interface HttpImpersonator


public interface HttpImpersonator

Interface for views to impersonate users over HTTP request.


Method Summary
 HttpURLConnection doAs(HttpURLConnection conn, String type)
           
 HttpURLConnection doAs(HttpURLConnection conn, String type, String username, String doAsParamName)
           
 String requestURL(String urlToRead, String requestType, ImpersonatorSetting impersonatorSetting)
          Returns the result of the HTTP request by setting the "doAs" impersonation for the query param and username in @param impersonatorSetting.
 

Method Detail

doAs

HttpURLConnection doAs(HttpURLConnection conn,
                       String type)
Parameters:
conn - HTTP connection that will be modified and returned
type - HTTP Request type: GET, PUT, POST, DELETE, etc.
Returns:
HTTP Connection object with the "doAs" query param set to the currently logged on user.

doAs

HttpURLConnection doAs(HttpURLConnection conn,
                       String type,
                       String username,
                       String doAsParamName)
Parameters:
conn - HTTP connection that will be modified and returned
type - HTTP Request type: GET, PUT, POST, DELETE, etc.
username - Username to impersonate
doAsParamName - Query param, typically "doAs"
Returns:
HTTP Connection object with the doAs query param set to the provider username.

requestURL

String requestURL(String urlToRead,
                  String requestType,
                  ImpersonatorSetting impersonatorSetting)
Returns the result of the HTTP request by setting the "doAs" impersonation for the query param and username in @param impersonatorSetting.

Parameters:
urlToRead - URL to request
requestType - HTTP Request type: GET, PUT, POST, DELETE, etc.
impersonatorSetting - Setting class with default values for username and doAs param name. To use different values, call the setters of the object.
Returns:
Return a response as a String


Copyright © 2015 Apache Software Foundation. All rights reserved.