Procházet zdrojové kódy

SEC-665: Renaming of rolemapping package to authoritymapping, and corresponding refactoring of classes.

Luke Taylor před 17 roky
rodič
revize
842c49c890
14 změnil soubory, kde provedl 96 přidání a 96 odebrání
  1. 5 5
      core/src/main/java/org/springframework/security/authoritymapping/Attributes2GrantedAuthoritiesMapper.java
  2. 19 0
      core/src/main/java/org/springframework/security/authoritymapping/MappableAttributesRetriever.java
  3. 3 3
      core/src/main/java/org/springframework/security/authoritymapping/SimpleAttributes2GrantedAuthoritiesMapper.java
  4. 5 5
      core/src/main/java/org/springframework/security/authoritymapping/SimpleMappableAttributesRetriever.java
  5. 10 10
      core/src/main/java/org/springframework/security/authoritymapping/XmlMappableAttributesRetriever.java
  6. 0 19
      core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java
  7. 8 8
      core/src/main/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource.java
  8. 7 7
      core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableAttributesRetriever.java
  9. 3 3
      core/src/test/java/org/springframework/security/authoritymapping/SimpleMappableRolesRetrieverTests.java
  10. 13 13
      core/src/test/java/org/springframework/security/authoritymapping/SimpleRoles2GrantedAuthoritiesMapperTests.java
  11. 9 9
      core/src/test/java/org/springframework/security/authoritymapping/XmlMappableRolesRetrieverTests.java
  12. 8 8
      core/src/test/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java
  13. 4 4
      core/src/test/java/org/springframework/security/ui/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java
  14. 2 2
      samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml

+ 5 - 5
core/src/main/java/org/springframework/security/rolemapping/Roles2GrantedAuthoritiesMapper.java → core/src/main/java/org/springframework/security/authoritymapping/Attributes2GrantedAuthoritiesMapper.java

@@ -1,18 +1,18 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import org.springframework.security.GrantedAuthority;
 
 /**
- * Interface to be implemented by classes that can map a list of roles to a list
- * of Acegi GrantedAuthorities.
+ * Interface to be implemented by classes that can map a list of security attributes (such as roles or
+ * group names) to a list of Spring Security GrantedAuthorities.
  *
  * @author Ruud Senden
  * @since 2.0
  */
-public interface Roles2GrantedAuthoritiesMapper {
+public interface Attributes2GrantedAuthoritiesMapper {
     /**
      * Implementations of this method should map the given list of roles to a
-     * list of Acegi GrantedAuthorities. There are no restrictions for the
+     * list of Spring Security GrantedAuthorities. There are no restrictions for the
      * mapping process; a single role can be mapped to multiple Acegi
      * GrantedAuthorities, all roles can be mapped to a single Acegi
      * GrantedAuthority, some roles may not be mapped, etc.

+ 19 - 0
core/src/main/java/org/springframework/security/authoritymapping/MappableAttributesRetriever.java

@@ -0,0 +1,19 @@
+package org.springframework.security.authoritymapping;
+
+/**
+ * Interface to be implemented by classes that can retrieve a list of mappable
+ * security attribute strings (for example the list of all available J2EE roles in a web or EJB
+ * application).
+ *
+ * @author Ruud Senden
+ * @since 2.0
+ */
+public interface MappableAttributesRetriever {
+    /**
+     * Implementations of this method should return a list of all string attributes which
+     * can be mapped to <tt>GrantedAuthority</tt>s.
+     *
+     * @return list of all mappable roles
+     */
+    String[] getMappableAttributes();
+}

+ 3 - 3
core/src/main/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapper.java → core/src/main/java/org/springframework/security/authoritymapping/SimpleAttributes2GrantedAuthoritiesMapper.java

@@ -1,4 +1,4 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import org.springframework.security.GrantedAuthority;
 import org.springframework.security.GrantedAuthorityImpl;
@@ -10,7 +10,7 @@ import org.springframework.util.Assert;
 
 /**
  * <p>
- * This class implements the Roles2GrantedAuthoritiesMapper interface by doing a
+ * This class implements the Attributes2GrantedAuthoritiesMapper interface by doing a
  * one-on-one mapping from roles to Acegi GrantedAuthorities. Optionally a
  * prefix can be added, and the role name can be converted to upper or lower
  * case.
@@ -21,7 +21,7 @@ import org.springframework.util.Assert;
  * @author Ruud Senden
  * @since 2.0
  */
-public class SimpleRoles2GrantedAuthoritiesMapper implements Roles2GrantedAuthoritiesMapper, InitializingBean {
+public class SimpleAttributes2GrantedAuthoritiesMapper implements Attributes2GrantedAuthoritiesMapper, InitializingBean {
     private String rolePrefix = "ROLE_";
 
     private boolean convertRoleToUpperCase = false;

+ 5 - 5
core/src/main/java/org/springframework/security/rolemapping/SimpleMappableRolesRetriever.java → core/src/main/java/org/springframework/security/authoritymapping/SimpleMappableAttributesRetriever.java

@@ -1,24 +1,24 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import org.springframework.util.Assert;
 
 /**
- * This class implements the MappableRolesRetriever interface by just returning
+ * This class implements the MappableAttributesRetriever interface by just returning
  * a list of mappable roles as previously set using the corresponding setter
  * method.
  *
  * @author Ruud Senden
  * @since 2.0
  */
-public class SimpleMappableRolesRetriever implements MappableRolesRetriever {
+public class SimpleMappableAttributesRetriever implements MappableAttributesRetriever {
     private String[] mappableRoles = null;
 
     /*
      * (non-Javadoc)
      *
-     * @see org.springframework.security.rolemapping.MappableRolesRetriever#getMappableRoles()
+     * @see org.springframework.security.authoritymapping.MappableAttributesRetriever#getMappableAttributes()
      */
-    public String[] getMappableRoles() {
+    public String[] getMappableAttributes() {
         Assert.notNull(mappableRoles, "No mappable roles have been set");
         String[] copy = new String[mappableRoles.length];
         System.arraycopy(mappableRoles, 0, copy, 0, copy.length);

+ 10 - 10
core/src/main/java/org/springframework/security/rolemapping/XmlMappableRolesRetriever.java → core/src/main/java/org/springframework/security/authoritymapping/XmlMappableAttributesRetriever.java

@@ -1,4 +1,4 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import java.io.FilterInputStream;
 import java.io.IOException;
@@ -26,7 +26,7 @@ import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
 /**
- * This implementation for the MappableRolesRetriever interface retrieves the
+ * This implementation for the MappableAttributesRetriever interface retrieves the
  * list of mappable roles from an XML file.
  * <p>
  * This class is defined as abstract because it is too generic to be used
@@ -38,8 +38,8 @@ import org.xml.sax.SAXException;
  * @author Ruud Senden
  * @since 2.0
  */
-public abstract class XmlMappableRolesRetriever implements MappableRolesRetriever, InitializingBean {
-    private static final Log LOG = LogFactory.getLog(XmlMappableRolesRetriever.class);
+public abstract class XmlMappableAttributesRetriever implements MappableAttributesRetriever, InitializingBean {
+    private static final Log logger = LogFactory.getLog(XmlMappableAttributesRetriever.class);
 
     private String[] mappableRoles = null;
 
@@ -58,7 +58,7 @@ public abstract class XmlMappableRolesRetriever implements MappableRolesRetrieve
         mappableRoles = getMappableRoles(xmlInputStream);
     }
 
-    public String[] getMappableRoles() {
+    public String[] getMappableAttributes() {
         String[] copy = new String[mappableRoles.length];
         System.arraycopy(mappableRoles, 0, copy, 0, copy.length);
         return copy;
@@ -68,14 +68,14 @@ public abstract class XmlMappableRolesRetriever implements MappableRolesRetrieve
      * Get the mappable roles from the specified XML document.
      */
     private String[] getMappableRoles(InputStream aStream) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Reading mappable roles from XML document");
+        if (logger.isDebugEnabled()) {
+            logger.debug("Reading mappable roles from XML document");
         }
         try {
             Document doc = getDocument(aStream);
             String[] roles = getMappableRoles(doc);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Mappable roles from XML document: " + ArrayUtils.toString(roles));
+            if (logger.isDebugEnabled()) {
+                logger.debug("Mappable roles from XML document: " + ArrayUtils.toString(roles));
             }
             return roles;
         } finally {
@@ -83,7 +83,7 @@ public abstract class XmlMappableRolesRetriever implements MappableRolesRetrieve
                 try {
                     aStream.close();
                 } catch (Exception e) {
-                    LOG.debug("Input stream could not be closed", e);
+                    logger.debug("Input stream could not be closed", e);
                 }
             }
         }

+ 0 - 19
core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java

@@ -1,19 +0,0 @@
-package org.springframework.security.rolemapping;
-
-/**
- * Interface to be implemented by classes that can retrieve a list of mappable
- * roles (for example the list of all available J2EE roles in a web or EJB
- * application).
- *
- * @author Ruud Senden
- * @since 2.0
- */
-public interface MappableRolesRetriever {
-    /**
-     * Implementations of this method should return a list of all mappable
-     * roles.
-     *
-     * @return list of all mappable roles
-     */
-    String[] getMappableRoles();
-}

+ 8 - 8
core/src/main/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource.java

@@ -4,8 +4,8 @@ import org.springframework.security.ui.preauth.PreAuthenticatedGrantedAuthoritie
 import org.springframework.security.ui.AuthenticationDetailsSourceImpl;
 import org.springframework.security.providers.preauth.PreAuthenticatedGrantedAuthoritiesSetter;
 import org.springframework.security.GrantedAuthority;
-import org.springframework.security.rolemapping.Roles2GrantedAuthoritiesMapper;
-import org.springframework.security.rolemapping.MappableRolesRetriever;
+import org.springframework.security.authoritymapping.Attributes2GrantedAuthoritiesMapper;
+import org.springframework.security.authoritymapping.MappableAttributesRetriever;
 
 import java.util.ArrayList;
 
@@ -22,7 +22,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource extends Aut
 
     private String[] j2eeMappableRoles;
 
-    private Roles2GrantedAuthoritiesMapper j2eeUserRoles2GrantedAuthoritiesMapper;
+    private Attributes2GrantedAuthoritiesMapper j2eeUserRoles2GrantedAuthoritiesMapper;
 
     /**
      * Public constructor which overrides the default AuthenticationDetails
@@ -84,17 +84,17 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource extends Aut
 
     /**
      * @param aJ2eeMappableRolesRetriever
-     *            The MappableRolesRetriever to use
+     *            The MappableAttributesRetriever to use
      */
-    public void setJ2eeMappableRolesRetriever(MappableRolesRetriever aJ2eeMappableRolesRetriever) {
-        this.j2eeMappableRoles = aJ2eeMappableRolesRetriever.getMappableRoles();
+    public void setJ2eeMappableRolesRetriever(MappableAttributesRetriever aJ2eeMappableRolesRetriever) {
+        this.j2eeMappableRoles = aJ2eeMappableRolesRetriever.getMappableAttributes();
     }
 
     /**
      * @param mapper
-     *            The Roles2GrantedAuthoritiesMapper to use
+     *            The Attributes2GrantedAuthoritiesMapper to use
      */
-    public void setJ2eeUserRoles2GrantedAuthoritiesMapper(Roles2GrantedAuthoritiesMapper mapper) {
+    public void setJ2eeUserRoles2GrantedAuthoritiesMapper(Attributes2GrantedAuthoritiesMapper mapper) {
         j2eeUserRoles2GrantedAuthoritiesMapper = mapper;
     }
 

+ 7 - 7
core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableRolesRetriever.java → core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableAttributesRetriever.java

@@ -2,21 +2,21 @@ package org.springframework.security.ui.preauth.j2ee;
 
 import java.io.InputStream;
 
-import org.springframework.security.rolemapping.XmlMappableRolesRetriever;
+import org.springframework.security.authoritymapping.XmlMappableAttributesRetriever;
 
 /**
  * <p>
- * This MappableRolesRetriever implementation reads the list of defined J2EE
+ * This MappableAttributesRetriever implementation reads the list of defined J2EE
  * roles from a web.xml file. It's functionality is based on the
- * XmlMappableRolesRetriever base class.
+ * XmlMappableAttributesRetriever base class.
  * <p>
- * Example on how to configure this MappableRolesRetriever in the Spring
+ * Example on how to configure this MappableAttributesRetriever in the Spring
  * configuration file:
  *
  * <pre>
  *
  *
- * &lt;bean id=&quot;j2eeMappableRolesRetriever&quot; class=&quot;org.springframework.security.ui.preauth.j2ee.WebXmlMappableRolesRetriever&quot;&gt;
+ * &lt;bean id=&quot;j2eeMappableRolesRetriever&quot; class=&quot;org.springframework.security.ui.preauth.j2ee.WebXmlMappableAttributesRetriever&quot;&gt;
  *     &lt;property name=&quot;webXmlInputStream&quot;&gt;&lt;bean factory-bean=&quot;webXmlResource&quot; factory-method=&quot;getInputStream&quot;/&gt;&lt;/property&gt;
  * &lt;/bean&gt;
  * &lt;bean id=&quot;webXmlResource&quot; class=&quot;org.springframework.web.context.support.ServletContextResource&quot;&gt;
@@ -30,13 +30,13 @@ import org.springframework.security.rolemapping.XmlMappableRolesRetriever;
  * @author Ruud Senden
  * @since 2.0
  */
-public class WebXmlMappableRolesRetriever extends XmlMappableRolesRetriever {
+public class WebXmlMappableAttributesRetriever extends XmlMappableAttributesRetriever {
     private static final String XPATH_EXPR = "/web-app/security-role/role-name/text()";
 
     /**
      * Constructor setting the XPath expression to use
      */
-    public WebXmlMappableRolesRetriever() {
+    public WebXmlMappableAttributesRetriever() {
         super.setXpathExpression(XPATH_EXPR);
     }
 

+ 3 - 3
core/src/test/java/org/springframework/security/rolemapping/SimpleMappableRolesRetrieverTests.java → core/src/test/java/org/springframework/security/authoritymapping/SimpleMappableRolesRetrieverTests.java

@@ -1,4 +1,4 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -14,9 +14,9 @@ public class SimpleMappableRolesRetrieverTests extends TestCase {
 
 	public final void testGetSetMappableRoles() {
 		String[] roles = new String[] { "Role1", "Role2" };
-		SimpleMappableRolesRetriever r = new SimpleMappableRolesRetriever();
+		SimpleMappableAttributesRetriever r = new SimpleMappableAttributesRetriever();
 		r.setMappableRoles(roles);
-		String[] result = r.getMappableRoles();
+		String[] result = r.getMappableAttributes();
 		Collection resultColl = Arrays.asList(result);
 		Collection rolesColl = Arrays.asList(roles);
 		assertTrue("Role collections do not match; result: " + resultColl + ", expected: " + rolesColl, rolesColl.containsAll(resultColl)

+ 13 - 13
core/src/test/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapperTests.java → core/src/test/java/org/springframework/security/authoritymapping/SimpleRoles2GrantedAuthoritiesMapperTests.java

@@ -1,4 +1,4 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import org.springframework.security.GrantedAuthority;
 
@@ -16,7 +16,7 @@ import junit.framework.TestCase;
 public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 
 	public final void testAfterPropertiesSetConvertToUpperAndLowerCase() {
-		SimpleRoles2GrantedAuthoritiesMapper mapper = new SimpleRoles2GrantedAuthoritiesMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper();
 		mapper.setConvertRoleToLowerCase(true);
 		mapper.setConvertRoleToUpperCase(true);
 		try {
@@ -29,7 +29,7 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	}
 
 	public final void testAfterPropertiesSet() {
-		SimpleRoles2GrantedAuthoritiesMapper mapper = new SimpleRoles2GrantedAuthoritiesMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper();
 		try {
 			mapper.afterPropertiesSet();
 		} catch (Exception unexpected) {
@@ -40,14 +40,14 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesNoConversion() {
 		String[] roles = { "Role1", "Role2" };
 		String[] expectedGas = { "Role1", "Role2" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
 	}
 
 	public final void testGetGrantedAuthoritiesToUpperCase() {
 		String[] roles = { "Role1", "Role2" };
 		String[] expectedGas = { "ROLE1", "ROLE2" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setConvertRoleToUpperCase(true);
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
 	}
@@ -55,7 +55,7 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesToLowerCase() {
 		String[] roles = { "Role1", "Role2" };
 		String[] expectedGas = { "role1", "role2" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setConvertRoleToLowerCase(true);
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
 	}
@@ -63,7 +63,7 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesAddPrefixIfAlreadyExisting() {
 		String[] roles = { "Role1", "Role2", "ROLE_Role3" };
 		String[] expectedGas = { "ROLE_Role1", "ROLE_Role2", "ROLE_ROLE_Role3" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setAddPrefixIfAlreadyExisting(true);
 		mapper.setRolePrefix("ROLE_");
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
@@ -72,7 +72,7 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesDontAddPrefixIfAlreadyExisting1() {
 		String[] roles = { "Role1", "Role2", "ROLE_Role3" };
 		String[] expectedGas = { "ROLE_Role1", "ROLE_Role2", "ROLE_Role3" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setAddPrefixIfAlreadyExisting(false);
 		mapper.setRolePrefix("ROLE_");
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
@@ -81,7 +81,7 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesDontAddPrefixIfAlreadyExisting2() {
 		String[] roles = { "Role1", "Role2", "role_Role3" };
 		String[] expectedGas = { "ROLE_Role1", "ROLE_Role2", "ROLE_role_Role3" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setAddPrefixIfAlreadyExisting(false);
 		mapper.setRolePrefix("ROLE_");
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
@@ -90,14 +90,14 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 	public final void testGetGrantedAuthoritiesCombination1() {
 		String[] roles = { "Role1", "Role2", "role_Role3" };
 		String[] expectedGas = { "ROLE_ROLE1", "ROLE_ROLE2", "ROLE_ROLE3" };
-		SimpleRoles2GrantedAuthoritiesMapper mapper = getDefaultMapper();
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = getDefaultMapper();
 		mapper.setAddPrefixIfAlreadyExisting(false);
 		mapper.setConvertRoleToUpperCase(true);
 		mapper.setRolePrefix("ROLE_");
 		testGetGrantedAuthorities(mapper, roles, expectedGas);
 	}
 
-	private void testGetGrantedAuthorities(SimpleRoles2GrantedAuthoritiesMapper mapper, String[] roles, String[] expectedGas) {
+	private void testGetGrantedAuthorities(SimpleAttributes2GrantedAuthoritiesMapper mapper, String[] roles, String[] expectedGas) {
 		GrantedAuthority[] result = mapper.getGrantedAuthorities(roles);
 		Collection resultColl = new ArrayList(result.length);
 		for (int i = 0; i < result.length; i++) {
@@ -109,8 +109,8 @@ public class SimpleRoles2GrantedAuthoritiesMapperTests extends TestCase {
 				&& resultColl.containsAll(expectedColl));
 	}
 
-	private SimpleRoles2GrantedAuthoritiesMapper getDefaultMapper() {
-		SimpleRoles2GrantedAuthoritiesMapper mapper = new SimpleRoles2GrantedAuthoritiesMapper();
+	private SimpleAttributes2GrantedAuthoritiesMapper getDefaultMapper() {
+		SimpleAttributes2GrantedAuthoritiesMapper mapper = new SimpleAttributes2GrantedAuthoritiesMapper();
 		mapper.setRolePrefix("");
 		mapper.setConvertRoleToLowerCase(false);
 		mapper.setConvertRoleToUpperCase(false);

+ 9 - 9
core/src/test/java/org/springframework/security/rolemapping/XmlMappableRolesRetrieverTests.java → core/src/test/java/org/springframework/security/authoritymapping/XmlMappableRolesRetrieverTests.java

@@ -1,4 +1,4 @@
-package org.springframework.security.rolemapping;
+package org.springframework.security.authoritymapping;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -21,7 +21,7 @@ public class XmlMappableRolesRetrieverTests extends TestCase {
 	private static final String[] DEFAULT_EXPECTED_ROLES = new String[] { "Role1", "Role2" };
 
 	public final void testAfterPropertiesSetException() {
-		TestXmlMappableRolesRetriever t = new TestXmlMappableRolesRetriever();
+		TestXmlMappableAttributesRetriever t = new TestXmlMappableAttributesRetriever();
 		try {
 			t.afterPropertiesSet();
 			fail("AfterPropertiesSet didn't throw expected exception");
@@ -32,8 +32,8 @@ public class XmlMappableRolesRetrieverTests extends TestCase {
 	}
 
 	public void testGetMappableRoles() {
-		XmlMappableRolesRetriever r = getXmlMappableRolesRetriever(true, getDefaultInputStream(), DEFAULT_XPATH);
-		String[] resultRoles = r.getMappableRoles();
+		XmlMappableAttributesRetriever r = getXmlMappableRolesRetriever(true, getDefaultInputStream(), DEFAULT_XPATH);
+		String[] resultRoles = r.getMappableAttributes();
 		assertNotNull("Result roles should not be null", resultRoles);
 		assertTrue("Number of result roles doesn't match expected number of roles", resultRoles.length == DEFAULT_EXPECTED_ROLES.length);
 		Collection resultRolesColl = Arrays.asList(resultRoles);
@@ -52,13 +52,13 @@ public class XmlMappableRolesRetrieverTests extends TestCase {
 
 	private void testCloseInputStream(boolean closeAfterRead) {
 		CloseableByteArrayInputStream is = getDefaultInputStream();
-		XmlMappableRolesRetriever r = getXmlMappableRolesRetriever(closeAfterRead, is, DEFAULT_XPATH);
-		r.getMappableRoles();
+		XmlMappableAttributesRetriever r = getXmlMappableRolesRetriever(closeAfterRead, is, DEFAULT_XPATH);
+		r.getMappableAttributes();
 		assertEquals(is.isClosed(), closeAfterRead);
 	}
 
-	private XmlMappableRolesRetriever getXmlMappableRolesRetriever(boolean closeInputStream, InputStream is, String xpath) {
-		XmlMappableRolesRetriever result = new TestXmlMappableRolesRetriever();
+	private XmlMappableAttributesRetriever getXmlMappableRolesRetriever(boolean closeInputStream, InputStream is, String xpath) {
+		XmlMappableAttributesRetriever result = new TestXmlMappableAttributesRetriever();
 		result.setCloseInputStream(closeInputStream);
 		result.setXmlInputStream(is);
 		result.setXpathExpression(xpath);
@@ -78,7 +78,7 @@ public class XmlMappableRolesRetrieverTests extends TestCase {
 		return new CloseableByteArrayInputStream(data.getBytes());
 	}
 
-	private static final class TestXmlMappableRolesRetriever extends XmlMappableRolesRetriever {
+	private static final class TestXmlMappableAttributesRetriever extends XmlMappableAttributesRetriever {
 	}
 
 	private static final class CloseableByteArrayInputStream extends ByteArrayInputStream {

+ 8 - 8
core/src/test/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java

@@ -9,10 +9,10 @@ import javax.servlet.http.HttpServletRequest;
 
 import junit.framework.TestCase;
 
-import org.springframework.security.rolemapping.MappableRolesRetriever;
-import org.springframework.security.rolemapping.Roles2GrantedAuthoritiesMapper;
-import org.springframework.security.rolemapping.SimpleMappableRolesRetriever;
-import org.springframework.security.rolemapping.SimpleRoles2GrantedAuthoritiesMapper;
+import org.springframework.security.authoritymapping.MappableAttributesRetriever;
+import org.springframework.security.authoritymapping.Attributes2GrantedAuthoritiesMapper;
+import org.springframework.security.authoritymapping.SimpleMappableAttributesRetriever;
+import org.springframework.security.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
 import org.springframework.security.ui.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
 import org.springframework.security.GrantedAuthority;
 
@@ -120,14 +120,14 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests extend
 		return result;
 	}
 
-	private MappableRolesRetriever getMappableRolesRetriever(String[] mappedRoles) {
-		SimpleMappableRolesRetriever result = new SimpleMappableRolesRetriever();
+	private MappableAttributesRetriever getMappableRolesRetriever(String[] mappedRoles) {
+		SimpleMappableAttributesRetriever result = new SimpleMappableAttributesRetriever();
 		result.setMappableRoles(mappedRoles);
 		return result;
 	}
 
-	private Roles2GrantedAuthoritiesMapper getJ2eeUserRoles2GrantedAuthoritiesMapper() {
-		SimpleRoles2GrantedAuthoritiesMapper result = new SimpleRoles2GrantedAuthoritiesMapper();
+	private Attributes2GrantedAuthoritiesMapper getJ2eeUserRoles2GrantedAuthoritiesMapper() {
+		SimpleAttributes2GrantedAuthoritiesMapper result = new SimpleAttributes2GrantedAuthoritiesMapper();
 		result.setAddPrefixIfAlreadyExisting(false);
 		result.setConvertRoleToLowerCase(false);
 		result.setConvertRoleToUpperCase(false);

+ 4 - 4
core/src/test/java/org/springframework/security/ui/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java

@@ -11,10 +11,10 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests extends TestCase {
 	public final void testRole1To4Roles() throws Exception {
 		final List ROLE1TO4_EXPECTED_ROLES = Arrays.asList(new String[] { "Role1", "Role2", "Role3", "Role4" });
 		InputStream role1to4InputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("webxml/Role1-4.web.xml");
-		WebXmlMappableRolesRetriever rolesRetriever = new WebXmlMappableRolesRetriever();
+		WebXmlMappableAttributesRetriever rolesRetriever = new WebXmlMappableAttributesRetriever();
 		rolesRetriever.setWebXmlInputStream(role1to4InputStream);
 		rolesRetriever.afterPropertiesSet();
-		String[] j2eeRoles = rolesRetriever.getMappableRoles();
+		String[] j2eeRoles = rolesRetriever.getMappableAttributes();
 		assertNotNull(j2eeRoles);
 		List j2eeRolesList = Arrays.asList(j2eeRoles);
 		assertTrue("J2eeRoles expected size: " + ROLE1TO4_EXPECTED_ROLES.size() + ", actual size: " + j2eeRolesList.size(), j2eeRolesList
@@ -25,10 +25,10 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests extends TestCase {
 
 	public final void testGetZeroJ2eeRoles() throws Exception {
 		InputStream noRolesInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("webxml/NoRoles.web.xml");
-		WebXmlMappableRolesRetriever rolesRetriever = new WebXmlMappableRolesRetriever();
+		WebXmlMappableAttributesRetriever rolesRetriever = new WebXmlMappableAttributesRetriever();
 		rolesRetriever.setWebXmlInputStream(noRolesInputStream);
 		rolesRetriever.afterPropertiesSet();
-		String[] j2eeRoles = rolesRetriever.getMappableRoles();
+		String[] j2eeRoles = rolesRetriever.getMappableAttributes();
 		assertTrue("J2eeRoles expected size: 0, actual size: " + j2eeRoles.length, j2eeRoles.length == 0);
 	}
 }

+ 2 - 2
samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml

@@ -65,11 +65,11 @@
         </property>
     </bean>
 
-	<bean id="j2eeUserRoles2GrantedAuthoritiesMapper" class="org.springframework.security.rolemapping.SimpleRoles2GrantedAuthoritiesMapper">
+	<bean id="j2eeUserRoles2GrantedAuthoritiesMapper" class="org.springframework.security.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper">
 	    <property name="convertRoleToUpperCase" value="true"/>
     </bean>
 
-	<bean id="j2eeMappableRolesRetriever" class="org.springframework.security.ui.preauth.j2ee.WebXmlMappableRolesRetriever">
+	<bean id="j2eeMappableRolesRetriever" class="org.springframework.security.ui.preauth.j2ee.WebXmlMappableAttributesRetriever">
 
 	<property name="webXmlInputStream"><bean factory-bean="webXmlResource" factory-method="getInputStream"/>
     </property>