public class HttpImpersonatorImpl extends Object implements org.apache.ambari.view.HttpImpersonator
Constructor and Description |
---|
HttpImpersonatorImpl(org.apache.ambari.view.ViewContext c) |
HttpImpersonatorImpl(org.apache.ambari.view.ViewContext c,
URLStreamProvider urlStreamProvider) |
Modifier and Type | Method and Description |
---|---|
HttpURLConnection |
doAs(HttpURLConnection conn,
String type) |
HttpURLConnection |
doAs(HttpURLConnection conn,
String type,
String username,
String doAsParamName) |
org.apache.ambari.view.ViewContext |
getContext() |
String |
getUsername() |
String |
requestURL(String url,
String requestType,
org.apache.ambari.view.ImpersonatorSetting impersonatorSetting)
Returns the result of the HTTP request by setting the "doAs" impersonation for the query param and username
in @param impersonatorSetting.
|
public HttpImpersonatorImpl(org.apache.ambari.view.ViewContext c)
public HttpImpersonatorImpl(org.apache.ambari.view.ViewContext c, URLStreamProvider urlStreamProvider)
public org.apache.ambari.view.ViewContext getContext()
public String getUsername()
public HttpURLConnection doAs(HttpURLConnection conn, String type)
doAs
in interface org.apache.ambari.view.HttpImpersonator
conn
- HTTP connection that will be modified and returnedtype
- HTTP Request type: GET, PUT, POST, DELETE, etc.public HttpURLConnection doAs(HttpURLConnection conn, String type, String username, String doAsParamName)
doAs
in interface org.apache.ambari.view.HttpImpersonator
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"public String requestURL(String url, String requestType, org.apache.ambari.view.ImpersonatorSetting impersonatorSetting)
requestURL
in interface org.apache.ambari.view.HttpImpersonator
url
- 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.Copyright © 2022 Apache Software Foundation. All rights reserved.