diff --git a/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java b/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java index 37bec35d2c..8e89141235 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java +++ b/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java @@ -233,7 +233,7 @@ public class SpringSecurityLdapTemplate extends LdapTemplate { * @param adapter - the Context to extract the DN from * @return - the String representing the full DN */ - protected String getAdapterDN(DirContextAdapter adapter) { + private String getAdapterDN(DirContextAdapter adapter) { //returns the full DN rather than the sub DN if a base is specified return adapter.getNameInNamespace(); } @@ -246,7 +246,7 @@ public class SpringSecurityLdapTemplate extends LdapTemplate { * @param record - the map holding the attribute names and values * @param attributeName - the name for which to fetch the values from */ - protected void extractStringAttributeValues(DirContextAdapter adapter, Map> record, String attributeName) { + private void extractStringAttributeValues(DirContextAdapter adapter, Map> record, String attributeName) { Object[] values = adapter.getObjectAttributes(attributeName); if (values == null || values.length == 0) { logger.debug("No attribute value found for '" + attributeName + "'"); diff --git a/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java b/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java index 318cdb9867..252a30b6a4 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java +++ b/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java @@ -320,32 +320,13 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator return ldapTemplate; } - /** - * Returns the default role - * Method available so that classes extending this can override - * @return the default role used - * @see {@link #setDefaultRole(String)} - */ - protected GrantedAuthority getDefaultRole() { - return defaultRole; - } - - /** - * Returns the search controls - * Method available so that classes extending this can override the search controls used - * @return the search controls - */ - protected SearchControls getSearchControls() { - return searchControls; - } - /** * Returns the attribute name of the LDAP attribute that will be mapped to the role name * Method available so that classes extending this can override * @return the attribute name used for role mapping * @see {@link #setGroupRoleAttribute(String)} */ - protected String getGroupRoleAttribute() { + protected final String getGroupRoleAttribute() { return groupRoleAttribute; } @@ -355,7 +336,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator * @return the search filter * @see {@link #setGroupSearchFilter(String)} */ - protected String getGroupSearchFilter() { + protected final String getGroupSearchFilter() { return groupSearchFilter; } @@ -365,7 +346,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator * @return the role prefix * @see {@link #setRolePrefix(String)} */ - protected String getRolePrefix() { + protected final String getRolePrefix() { return rolePrefix; } @@ -375,9 +356,26 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator * @return true if role names are converted to uppercase. * @see {@link #setConvertToUpperCase(boolean)} */ - protected boolean isConvertToUpperCase() { + protected final boolean isConvertToUpperCase() { return convertToUpperCase; } + /** + * Returns the default role + * Method available so that classes extending this can override + * @return the default role used + * @see {@link #setDefaultRole(String)} + */ + private GrantedAuthority getDefaultRole() { + return defaultRole; + } + /** + * Returns the search controls + * Method available so that classes extending this can override the search controls used + * @return the search controls + */ + private SearchControls getSearchControls() { + return searchControls; + } } diff --git a/ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java b/ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java index 53ab9842b1..b8dcc685bd 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java +++ b/ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java @@ -159,7 +159,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula * @param authorities - the authorities set that will be populated, must not be null * @param depth - the depth remaining, when 0 recursion will end */ - protected void performNestedSearch(String userDn, String username, Set authorities, int depth) { + private void performNestedSearch(String userDn, String username, Set authorities, int depth) { if (depth == 0) { //back out of recursion if (logger.isDebugEnabled()) { @@ -223,7 +223,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula * * @return the attribute names or null for all */ - public Set getAttributeNames() { + private Set getAttributeNames() { return attributeNames; } @@ -241,7 +241,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula * * @return the max search depth, default is 10 */ - public int getMaxSearchDepth() { + private int getMaxSearchDepth() { return maxSearchDepth; }