mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 21:51:00 +08:00
SQOOP-1775: Sqoop2: Migrate to URL parameter user.name instead of using header
(Abraham Elmahrek via Jarek Jarcec Cecho)
This commit is contained in:
parent
39ab0a6f25
commit
ad35c19a1d
@ -56,8 +56,6 @@ protected String doHttpRequest(String strURL, String method, String data) {
|
||||
HttpURLConnection conn = new AuthenticatedURL().openConnection(url, token);
|
||||
|
||||
conn.setRequestMethod(method);
|
||||
// Provide name of user executing request
|
||||
conn.setRequestProperty(SqoopProtocolConstants.HEADER_SQOOP_USERNAME, System.getProperty("user.name"));
|
||||
// Sqoop is using JSON for data transfers
|
||||
conn.setRequestProperty("Accept", MediaType.APPLICATION_JSON);
|
||||
// Transfer client locale to return client specific data
|
||||
|
@ -18,8 +18,6 @@
|
||||
package org.apache.sqoop.common;
|
||||
|
||||
public final class SqoopProtocolConstants {
|
||||
public static final String HEADER_SQOOP_USERNAME = "sqoop-user-name";
|
||||
|
||||
public static final String HEADER_SQOOP_ERROR_CODE = "sqoop-error-code";
|
||||
|
||||
public static final String HEADER_SQOOP_ERROR_MESSAGE = "sqoop-error-message";
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package org.apache.sqoop.server;
|
||||
|
||||
import org.apache.hadoop.security.authentication.client.PseudoAuthenticator;
|
||||
import org.apache.sqoop.common.SqoopException;
|
||||
import org.apache.sqoop.common.SqoopProtocolConstants;
|
||||
import org.apache.sqoop.server.common.ServerError;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -119,6 +119,6 @@ public Locale getAcceptLanguageHeader() {
|
||||
* @return Name of user sending the request
|
||||
*/
|
||||
public String getUserName() {
|
||||
return request.getHeader(SqoopProtocolConstants.HEADER_SQOOP_USERNAME);
|
||||
return request.getParameter(PseudoAuthenticator.USER_NAME);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user