org.apache.ambari.view
Interface HttpImpersonator
public interface HttpImpersonator
Interface for views to impersonate users over HTTP request.
doAs
HttpURLConnection doAs(HttpURLConnection conn,
String type)
- Parameters:
conn - HTTP connection that will be modified and returnedtype - 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 returnedtype - HTTP Request type: GET, PUT, POST, DELETE, etc.username - Username to impersonatedoAsParamName - 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 requestrequestType - 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.