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

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

@ -239,8 +239,9 @@ public class SpringSecurityLdapTemplate extends LdapTemplate { @@ -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
* If a value is not of type String, it will derive it's value from the {@link Object#toString()}
* Extracts String values for a specified attribute name and places them in the map representing the ldap record If
* 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 record - the map holding the attribute names and values
* @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; @@ -20,9 +20,9 @@ import org.springframework.security.core.GrantedAuthority;
import java.util.Map;
/**
* An authority that contains at least a DN and a role name for an LDAP entry
* but can also contain other desired attributes to be fetched during an LDAP
* authority search.
* An authority that contains at least a DN and a role name for an LDAP entry but can also contain other desired
* attributes to be fetched during an LDAP authority search.
*
* @author Filip Hanik
*/
public class LdapAuthority implements GrantedAuthority {
@ -34,6 +34,7 @@ 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
*
* @param role
* @param dn
*/
@ -43,6 +44,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -43,6 +44,7 @@ public class LdapAuthority implements GrantedAuthority {
/**
* Constructs an LdapAuthority with the given role, DN and other LDAP attributes
*
* @param role
* @param dn
* @param attributes
@ -56,6 +58,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -56,6 +58,7 @@ public class LdapAuthority implements GrantedAuthority {
/**
* Returns the LDAP attributes
*
* @return the LDAP attributes, map can be null
*/
public Map<String, String[]> getAttributes() {
@ -64,6 +67,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -64,6 +67,7 @@ public class LdapAuthority implements GrantedAuthority {
/**
* Returns the DN for this LDAP authority
*
* @return
*/
public String getDn() {
@ -72,6 +76,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -72,6 +76,7 @@ public class LdapAuthority implements GrantedAuthority {
/**
* Returns the values for a specific attribute
*
* @param name the attribute name
* @return a String array, never null but may be zero length
*/
@ -88,6 +93,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -88,6 +93,7 @@ public class LdapAuthority implements GrantedAuthority {
/**
* Returns the first attribute value for a specified attribute
*
* @param name
* @return the first attribute value for a specified attribute, may be null
*/
@ -109,8 +115,7 @@ public class LdapAuthority implements GrantedAuthority { @@ -109,8 +115,7 @@ public class LdapAuthority implements GrantedAuthority {
}
/**
* Compares the LdapAuthority based on {@link #getAuthority()} and {@link #getDn()} values
* {@inheritDoc}
* Compares the LdapAuthority based on {@link #getAuthority()} and {@link #getDn()} values {@inheritDoc}
*/
@Override
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; @@ -28,8 +28,7 @@ import java.util.Map;
import java.util.Set;
/**
* A LDAP authority populator that can recursively search static nested groups.
* <p>An example of nested groups can be
* A LDAP authority populator that can recursively search static nested groups. <p>An example of nested groups can be
* <pre>
* #Nested groups data
*
@ -128,9 +127,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -128,9 +127,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
* Maximum search depth - represents the number of recursive searches performed
*/
private int maxSearchDepth = 10;
/**
* Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be
* set as a property.
* Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be set as a property.
*
* @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
@ -157,6 +156,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -157,6 +156,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
/**
* Performs the nested group search
*
* @param userDn - the userDN to search for, will become the group DN for subsequent searches
* @param username - the username of the user
* @param authorities - the authorities set that will be populated, must not be null
@ -219,8 +219,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -219,8 +219,9 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
}
/**
* Returns the attribute names that this populator has been configured to retrieve
* Value can be null, represents fetch all attributes
* Returns the attribute names that this populator has been configured to retrieve Value can be null, represents
* fetch all attributes
*
* @return the attribute names or null for all
*/
public Set<String> getAttributeNames() {
@ -229,6 +230,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -229,6 +230,7 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
/**
* Sets the attribute names to retrieve for each ldap groups. Null means retrieve all
*
* @param attributeNames - the names of the LDAP attributes to retrieve
*/
public void setAttributeNames(Set<String> attributeNames) {
@ -236,8 +238,8 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -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
* parent groups.
* How far should a nested search go. Depth is calculated in the number of levels we search up for parent groups.
*
* @return the max search depth, default is 10
*/
public int getMaxSearchDepth() {
@ -245,8 +247,8 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -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
* parent groups.
* How far should a nested search go. Depth is calculated in the number of levels we search up for parent groups.
*
* @param maxSearchDepth the max search depth
*/
public void setMaxSearchDepth(int maxSearchDepth) {
@ -254,5 +256,4 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula @@ -254,5 +256,4 @@ public class NestedLdapAuthoritiesPopulator extends DefaultLdapAuthoritiesPopula
}
}

Loading…
Cancel
Save