Browse Source

SEC-2690: Formatting cleanup

pull/117/head
Rob Winch 12 years ago
parent
commit
6b43b261bc
  1. 5
      ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java
  2. 5
      ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java
  3. 15
      ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapAuthority.java
  4. 23
      ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java

5
ldap/src/integration-test/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulatorTests.java

@ -25,10 +25,7 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/** /**
* @author Filip Hanik * @author Filip Hanik

5
ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java

@ -239,8 +239,9 @@ public class SpringSecurityLdapTemplate extends LdapTemplate {
} }
/** /**
* Extracts String values for a specified attribute name and places them in the map representing the ldap record * Extracts String values for a specified attribute name and places them in the map representing the ldap record If
* If a value is not of type String, it will derive it's value from the {@link Object#toString()} * a value is not of type String, it will derive it's value from the {@link Object#toString()}
*
* @param adapter - the adapter that contains the values * @param adapter - the adapter that contains the values
* @param record - the map holding the attribute names and values * @param record - the map holding the attribute names and values
* @param attributeName - the name for which to fetch the values from * @param attributeName - the name for which to fetch the values from

15
ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapAuthority.java

@ -20,9 +20,9 @@ import org.springframework.security.core.GrantedAuthority;
import java.util.Map; import java.util.Map;
/** /**
* An authority that contains at least a DN and a role name for an LDAP entry * An authority that contains at least a DN and a role name for an LDAP entry but can also contain other desired
* but can also contain other desired attributes to be fetched during an LDAP * attributes to be fetched during an LDAP authority search.
* authority search. *
* @author Filip Hanik * @author Filip Hanik
*/ */
public class LdapAuthority implements GrantedAuthority { public class LdapAuthority implements GrantedAuthority {
@ -34,6 +34,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Constructs an LdapAuthority that has a role and a DN but no other attributes * Constructs an LdapAuthority that has a role and a DN but no other attributes
*
* @param role * @param role
* @param dn * @param dn
*/ */
@ -43,6 +44,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Constructs an LdapAuthority with the given role, DN and other LDAP attributes * Constructs an LdapAuthority with the given role, DN and other LDAP attributes
*
* @param role * @param role
* @param dn * @param dn
* @param attributes * @param attributes
@ -56,6 +58,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Returns the LDAP attributes * Returns the LDAP attributes
*
* @return the LDAP attributes, map can be null * @return the LDAP attributes, map can be null
*/ */
public Map<String, String[]> getAttributes() { public Map<String, String[]> getAttributes() {
@ -64,6 +67,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Returns the DN for this LDAP authority * Returns the DN for this LDAP authority
*
* @return * @return
*/ */
public String getDn() { public String getDn() {
@ -72,6 +76,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Returns the values for a specific attribute * Returns the values for a specific attribute
*
* @param name the attribute name * @param name the attribute name
* @return a String array, never null but may be zero length * @return a String array, never null but may be zero length
*/ */
@ -88,6 +93,7 @@ public class LdapAuthority implements GrantedAuthority {
/** /**
* Returns the first attribute value for a specified attribute * Returns the first attribute value for a specified attribute
*
* @param name * @param name
* @return the first attribute value for a specified attribute, may be null * @return the first attribute value for a specified attribute, may be null
*/ */
@ -109,8 +115,7 @@ public class LdapAuthority implements GrantedAuthority {
} }
/** /**
* Compares the LdapAuthority based on {@link #getAuthority()} and {@link #getDn()} values * Compares the LdapAuthority based on {@link #getAuthority()} and {@link #getDn()} values {@inheritDoc}
* {@inheritDoc}
*/ */
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {

23
ldap/src/main/java/org/springframework/security/ldap/userdetails/NestedLdapAuthoritiesPopulator.java

@ -28,8 +28,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* A LDAP authority populator that can recursively search static nested groups. * A LDAP authority populator that can recursively search static nested groups. <p>An example of nested groups can be
* <p>An example of nested groups can be
* <pre> * <pre>
* #Nested groups data * #Nested groups data
* *
@ -128,9 +127,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
* Maximum search depth - represents the number of recursive searches performed * Maximum search depth - represents the number of recursive searches performed
*/ */
private int maxSearchDepth = 10; private int maxSearchDepth = 10;
/** /**
* Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be * Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be set as a property.
* set as a property.
* *
* @param contextSource supplies the contexts used to search for user roles. * @param contextSource supplies the contexts used to search for user roles.
* @param groupSearchBase if this is an empty string the search will be performed from the root DN of the * @param groupSearchBase if this is an empty string the search will be performed from the root DN of the
@ -157,6 +156,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
/** /**
* Performs the nested group search * Performs the nested group search
*
* @param userDn - the userDN to search for, will become the group DN for subsequent searches * @param userDn - the userDN to search for, will become the group DN for subsequent searches
* @param username - the username of the user * @param username - the username of the user
* @param authorities - the authorities set that will be populated, must not be null * @param authorities - the authorities set that will be populated, must not be null
@ -219,8 +219,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
} }
/** /**
* Returns the attribute names that this populator has been configured to retrieve * Returns the attribute names that this populator has been configured to retrieve Value can be null, represents
* Value can be null, represents fetch all attributes * fetch all attributes
*
* @return the attribute names or null for all * @return the attribute names or null for all
*/ */
public Set<String> getAttributeNames() { public Set<String> getAttributeNames() {
@ -229,6 +230,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
/** /**
* Sets the attribute names to retrieve for each ldap groups. Null means retrieve all * Sets the attribute names to retrieve for each ldap groups. Null means retrieve all
*
* @param attributeNames - the names of the LDAP attributes to retrieve * @param attributeNames - the names of the LDAP attributes to retrieve
*/ */
public void setAttributeNames(Set<String> attributeNames) { public void setAttributeNames(Set<String> attributeNames) {
@ -236,8 +238,8 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
} }
/** /**
* How far should a nested search go. Depth is calculated in the number of levels we search up for * How far should a nested search go. Depth is calculated in the number of levels we search up for parent groups.
* parent groups. *
* @return the max search depth, default is 10 * @return the max search depth, default is 10
*/ */
public int getMaxSearchDepth() { public int getMaxSearchDepth() {
@ -245,8 +247,8 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
} }
/** /**
* How far should a nested search go. Depth is calculated in the number of levels we search up for * How far should a nested search go. Depth is calculated in the number of levels we search up for parent groups.
* parent groups. *
* @param maxSearchDepth the max search depth * @param maxSearchDepth the max search depth
*/ */
public void setMaxSearchDepth(int maxSearchDepth) { public void setMaxSearchDepth(int maxSearchDepth) {
@ -254,5 +256,4 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
} }
} }

Loading…
Cancel
Save