@Test(expected = IllegalArgumentException.class) public void testAddNewRuleWithNoRealm() { AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); builder.addRule("someUser", "hdfs"); }
public void addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a principal with no realm: " + principal); } Rule rule = createHostAgnosticRule(p, localUsername); setRules.add(rule); } }
AuthToLocalBuilder implements Cloneable { public void addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a principal with no realm: " + principal); } Rule rule = createHostAgnosticRule(p, localUsername); setRules.add(rule); } } }
AuthToLocalBuilder implements Cloneable { public void addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a principal with no realm: " + principal); } Rule rule = createHostAgnosticRule(p, localUsername); setRules.add(rule); } } AuthToLocalBuilder(String defaultRealm, String additionalRealms, boolean caseInsensitiveUserSupport);  AuthToLocalBuilder(String defaultRealm, Collection<String> additionalRealms, boolean caseInsensitiveUserSupport); }
AuthToLocalBuilder implements Cloneable { public void addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a principal with no realm: " + principal); } Rule rule = createHostAgnosticRule(p, localUsername); setRules.add(rule); } } AuthToLocalBuilder(String defaultRealm, String additionalRealms, boolean caseInsensitiveUserSupport);  AuthToLocalBuilder(String defaultRealm, Collection<String> additionalRealms, boolean caseInsensitiveUserSupport); @Override Object clone(); void addRules(String authToLocalRules); void addRule(String principal, String localUsername); String generate(); String generate(ConcatenationType concatenationType); }
AuthToLocalBuilder implements Cloneable { public void addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a principal with no realm: " + principal); } Rule rule = createHostAgnosticRule(p, localUsername); setRules.add(rule); } } AuthToLocalBuilder(String defaultRealm, String additionalRealms, boolean caseInsensitiveUserSupport);  AuthToLocalBuilder(String defaultRealm, Collection<String> additionalRealms, boolean caseInsensitiveUserSupport); @Override Object clone(); void addRules(String authToLocalRules); void addRule(String principal, String localUsername); String generate(); String generate(ConcatenationType concatenationType); static final ConcatenationType DEFAULT_CONCATENATION_TYPE; }