private boolean isAllowedDelegationTokenOp(UserGroupInformation ugi) throws IOException {
    AuthenticationMethod authMethod = ugi.getAuthenticationMethod();
    if (authMethod == AuthenticationMethod.PROXY) {
      authMethod = ugi.getRealUser().getAuthenticationMethod();
    }
    if (
      authMethod != AuthenticationMethod.KERBEROS && authMethod != AuthenticationMethod.KERBEROS_SSL
        && authMethod != AuthenticationMethod.CERTIFICATE
    ) {
      return false;
    }
    return true;
  }
@param ugi A user group information.
@return true if delegation token operation is allowed
hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenProvider.java