|
@@ -269,25 +269,8 @@ public final class TimelineReaderWebServicesUtils {
|
|
|
* @return UGI.
|
|
|
*/
|
|
|
public static UserGroupInformation getUser(HttpServletRequest req) {
|
|
|
- return getCallerUserGroupInformation(req, false);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Get UGI from the HTTP request.
|
|
|
- *
|
|
|
- * @param hsr HTTP request.
|
|
|
- * @param usePrincipal if true, use principal name else use remote user name
|
|
|
- * @return UGI.
|
|
|
- */
|
|
|
- public static UserGroupInformation getCallerUserGroupInformation(
|
|
|
- HttpServletRequest hsr, boolean usePrincipal) {
|
|
|
-
|
|
|
- String remoteUser = hsr.getRemoteUser();
|
|
|
- if (usePrincipal) {
|
|
|
- Principal princ = hsr.getUserPrincipal();
|
|
|
- remoteUser = princ == null ? null : princ.getName();
|
|
|
- }
|
|
|
-
|
|
|
+ Principal princ = req.getUserPrincipal();
|
|
|
+ String remoteUser = princ == null ? null : princ.getName();
|
|
|
UserGroupInformation callerUGI = null;
|
|
|
if (remoteUser != null) {
|
|
|
callerUGI = UserGroupInformation.createRemoteUser(remoteUser);
|