private Rule createDefaultRealmRule(String realm, boolean caseInsensitive) {
    return new Rule(
      MatchingRule.ignoreHostWhenComponentCountIs(1),
      new Principal(".*@" + realm),
      new Substitution("@.*", "", "", caseInsensitive));
  }
Create a default rule for a realm which matches all principals with 1 component and the same realm.

@param realm realm that the rule is being created for
@param caseInsensitive true if the rule should be case-insensitive; otherwise false
@return a new default realm rule
ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java