@Test(expected=IllegalArgumentException.class) public void testSetUserDnTemplateNull() { realm.setUserDnTemplate(null); }
public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index < 0) { String msg = "User DN template must contain the '" + USERDN_SUBSTITUTION_TOKEN + "' replacement token to understand where to " + "insert the runtime authentication principal."; throw new IllegalArgumentException(msg); } String prefix = template.substring(0, index); String suffix = template.substring(prefix.length() + USERDN_SUBSTITUTION_TOKEN.length()); if (log.isDebugEnabled()) { log.debug("Determined user DN prefix [{}] and suffix [{}]", prefix, suffix); } this.userDnPrefix = prefix; this.userDnSuffix = suffix; }
DefaultLdapRealm extends AuthorizingRealm { public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index < 0) { String msg = "User DN template must contain the '" + USERDN_SUBSTITUTION_TOKEN + "' replacement token to understand where to " + "insert the runtime authentication principal."; throw new IllegalArgumentException(msg); } String prefix = template.substring(0, index); String suffix = template.substring(prefix.length() + USERDN_SUBSTITUTION_TOKEN.length()); if (log.isDebugEnabled()) { log.debug("Determined user DN prefix [{}] and suffix [{}]", prefix, suffix); } this.userDnPrefix = prefix; this.userDnSuffix = suffix; } }
DefaultLdapRealm extends AuthorizingRealm { public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index < 0) { String msg = "User DN template must contain the '" + USERDN_SUBSTITUTION_TOKEN + "' replacement token to understand where to " + "insert the runtime authentication principal."; throw new IllegalArgumentException(msg); } String prefix = template.substring(0, index); String suffix = template.substring(prefix.length() + USERDN_SUBSTITUTION_TOKEN.length()); if (log.isDebugEnabled()) { log.debug("Determined user DN prefix [{}] and suffix [{}]", prefix, suffix); } this.userDnPrefix = prefix; this.userDnSuffix = suffix; } DefaultLdapRealm(); }
DefaultLdapRealm extends AuthorizingRealm { public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index < 0) { String msg = "User DN template must contain the '" + USERDN_SUBSTITUTION_TOKEN + "' replacement token to understand where to " + "insert the runtime authentication principal."; throw new IllegalArgumentException(msg); } String prefix = template.substring(0, index); String suffix = template.substring(prefix.length() + USERDN_SUBSTITUTION_TOKEN.length()); if (log.isDebugEnabled()) { log.debug("Determined user DN prefix [{}] and suffix [{}]", prefix, suffix); } this.userDnPrefix = prefix; this.userDnSuffix = suffix; } DefaultLdapRealm(); void setUserDnTemplate(String template); String getUserDnTemplate(); @SuppressWarnings({"UnusedDeclaration"}) void setContextFactory(LdapContextFactory contextFactory); LdapContextFactory getContextFactory(); }
DefaultLdapRealm extends AuthorizingRealm { public void setUserDnTemplate(String template) throws IllegalArgumentException { if (!StringUtils.hasText(template)) { String msg = "User DN template cannot be null or empty."; throw new IllegalArgumentException(msg); } int index = template.indexOf(USERDN_SUBSTITUTION_TOKEN); if (index < 0) { String msg = "User DN template must contain the '" + USERDN_SUBSTITUTION_TOKEN + "' replacement token to understand where to " + "insert the runtime authentication principal."; throw new IllegalArgumentException(msg); } String prefix = template.substring(0, index); String suffix = template.substring(prefix.length() + USERDN_SUBSTITUTION_TOKEN.length()); if (log.isDebugEnabled()) { log.debug("Determined user DN prefix [{}] and suffix [{}]", prefix, suffix); } this.userDnPrefix = prefix; this.userDnSuffix = suffix; } DefaultLdapRealm(); void setUserDnTemplate(String template); String getUserDnTemplate(); @SuppressWarnings({"UnusedDeclaration"}) void setContextFactory(LdapContextFactory contextFactory); LdapContextFactory getContextFactory();  }