@Override
  public List<String> getGroupNames() {
       // In case of embedded hs2, sessionState.getUserName()=null
    if (groups == null && sessionState.getUserName() != null) {
      groups = UserGroupInformation.createRemoteUser(sessionState.getUserName()).getGroups();
    }
    return groups;
  }
Authenticator that returns the userName set in SessionState. For use when authorizing with HS2
so that HS2 can set the user for the session through SessionState
ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java