As noticed during discussions in
YARN-6820, the webservices in timeline service v2 get the UGI created from the user obtained by invoking getRemoteUser on the HttpServletRequest .
It will be good to use getUserPrincipal instead of invoking getRemoteUser on the HttpServletRequest.
Filing jira to update the code.
Per Java EE documentations for 6 and 7, the behavior around getRemoteUser and getUserPrincipal is listed at:
getRemoteUser, which determines the user name with which the client authenticated. The getRemoteUser method returns the name of the remote user (the caller) associated by the container with the request. If no user has been authenticated, this method returns null.
getUserPrincipal, which determines the principal name of the current user and returns a java.security.Principal object. If no user has been authenticated, this method returns null. Calling the getName method on the Principal returned by getUserPrincipal returns the name of the remote user.