public static HivePrincipal getValidatedPrincipal(HivePrincipal hPrincipal)
      throws HiveAuthzPluginException {
    if (hPrincipal == null || hPrincipal.getType() == null) {
      // null principal
      return hPrincipal;
    }
    switch (hPrincipal.getType()) {
    case USER:
      return hPrincipal;
    case ROLE:
      // lower case role names, for case insensitive behavior
      return new HivePrincipal(hPrincipal.getName().toLowerCase(), hPrincipal.getType());
    default:
      throw new HiveAuthzPluginException("Invalid principal type in principal " + hPrincipal);
    }
  }
Validate the principal type, and convert role name to lower case
@param hPrincipal
@return validated principal
@throws HiveAuthzPluginException
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLAuthorizationUtils.java