From 842c49c89064218b0b27c9f0e993b96dcf8866b5 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Fri, 8 Feb 2008 12:01:10 +0000 Subject: [PATCH] SEC-665: Renaming of rolemapping package to authoritymapping, and corresponding refactoring of classes. --- .../Attributes2GrantedAuthoritiesMapper.java} | 10 +++---- .../MappableAttributesRetriever.java | 19 ++++++++++++++ ...eAttributes2GrantedAuthoritiesMapper.java} | 6 ++--- .../SimpleMappableAttributesRetriever.java} | 10 +++---- .../XmlMappableAttributesRetriever.java} | 20 +++++++------- .../rolemapping/MappableRolesRetriever.java | 19 -------------- ...ticatedWebAuthenticationDetailsSource.java | 16 ++++++------ ...=> WebXmlMappableAttributesRetriever.java} | 14 +++++----- .../SimpleMappableRolesRetrieverTests.java | 6 ++--- ...leRoles2GrantedAuthoritiesMapperTests.java | 26 +++++++++---------- .../XmlMappableRolesRetrieverTests.java | 18 ++++++------- ...edWebAuthenticationDetailsSourceTests.java | 16 ++++++------ .../WebXmlJ2eeDefinedRolesRetrieverTests.java | 8 +++--- .../WEB-INF/applicationContext-security.xml | 4 +-- 14 files changed, 96 insertions(+), 96 deletions(-) rename core/src/main/java/org/springframework/security/{rolemapping/Roles2GrantedAuthoritiesMapper.java => authoritymapping/Attributes2GrantedAuthoritiesMapper.java} (66%) create mode 100755 core/src/main/java/org/springframework/security/authoritymapping/MappableAttributesRetriever.java rename core/src/main/java/org/springframework/security/{rolemapping/SimpleRoles2GrantedAuthoritiesMapper.java => authoritymapping/SimpleAttributes2GrantedAuthoritiesMapper.java} (89%) rename core/src/main/java/org/springframework/security/{rolemapping/SimpleMappableRolesRetriever.java => authoritymapping/SimpleMappableAttributesRetriever.java} (62%) rename core/src/main/java/org/springframework/security/{rolemapping/XmlMappableRolesRetriever.java => authoritymapping/XmlMappableAttributesRetriever.java} (86%) delete mode 100755 core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java rename core/src/main/java/org/springframework/security/ui/preauth/j2ee/{WebXmlMappableRolesRetriever.java => WebXmlMappableAttributesRetriever.java} (71%) rename core/src/test/java/org/springframework/security/{rolemapping => authoritymapping}/SimpleMappableRolesRetrieverTests.java (74%) rename core/src/test/java/org/springframework/security/{rolemapping => authoritymapping}/SimpleRoles2GrantedAuthoritiesMapperTests.java (75%) rename core/src/test/java/org/springframework/security/{rolemapping => authoritymapping}/XmlMappableRolesRetrieverTests.java (74%) diff --git a/core/src/main/java/org/springframework/security/rolemapping/Roles2GrantedAuthoritiesMapper.java b/core/src/main/java/org/springframework/security/authoritymapping/Attributes2GrantedAuthoritiesMapper.java similarity index 66% rename from core/src/main/java/org/springframework/security/rolemapping/Roles2GrantedAuthoritiesMapper.java rename to core/src/main/java/org/springframework/security/authoritymapping/Attributes2GrantedAuthoritiesMapper.java index 1ccbfa233f..9d6f26fb90 100755 --- a/core/src/main/java/org/springframework/security/rolemapping/Roles2GrantedAuthoritiesMapper.java +++ b/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. diff --git a/core/src/main/java/org/springframework/security/authoritymapping/MappableAttributesRetriever.java b/core/src/main/java/org/springframework/security/authoritymapping/MappableAttributesRetriever.java new file mode 100755 index 0000000000..6f4b74f774 --- /dev/null +++ b/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 GrantedAuthoritys. + * + * @return list of all mappable roles + */ + String[] getMappableAttributes(); +} diff --git a/core/src/main/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapper.java b/core/src/main/java/org/springframework/security/authoritymapping/SimpleAttributes2GrantedAuthoritiesMapper.java similarity index 89% rename from core/src/main/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapper.java rename to core/src/main/java/org/springframework/security/authoritymapping/SimpleAttributes2GrantedAuthoritiesMapper.java index 302ecb68ea..0aa1d860f9 100755 --- a/core/src/main/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapper.java +++ b/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; /** *

- * 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; diff --git a/core/src/main/java/org/springframework/security/rolemapping/SimpleMappableRolesRetriever.java b/core/src/main/java/org/springframework/security/authoritymapping/SimpleMappableAttributesRetriever.java similarity index 62% rename from core/src/main/java/org/springframework/security/rolemapping/SimpleMappableRolesRetriever.java rename to core/src/main/java/org/springframework/security/authoritymapping/SimpleMappableAttributesRetriever.java index 0fb26d8c70..c751699b8b 100755 --- a/core/src/main/java/org/springframework/security/rolemapping/SimpleMappableRolesRetriever.java +++ b/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); diff --git a/core/src/main/java/org/springframework/security/rolemapping/XmlMappableRolesRetriever.java b/core/src/main/java/org/springframework/security/authoritymapping/XmlMappableAttributesRetriever.java similarity index 86% rename from core/src/main/java/org/springframework/security/rolemapping/XmlMappableRolesRetriever.java rename to core/src/main/java/org/springframework/security/authoritymapping/XmlMappableAttributesRetriever.java index 51eb738193..acce137a0c 100755 --- a/core/src/main/java/org/springframework/security/rolemapping/XmlMappableRolesRetriever.java +++ b/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. *

* 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); } } } diff --git a/core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java b/core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java deleted file mode 100755 index b5f4dc0670..0000000000 --- a/core/src/main/java/org/springframework/security/rolemapping/MappableRolesRetriever.java +++ /dev/null @@ -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(); -} diff --git a/core/src/main/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource.java b/core/src/main/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource.java index 0af714e0fa..655c0ce865 100755 --- a/core/src/main/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource.java +++ b/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; } diff --git a/core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableRolesRetriever.java b/core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableAttributesRetriever.java similarity index 71% rename from core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableRolesRetriever.java rename to core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableAttributesRetriever.java index 754b0f8aa7..1fcb4afb25 100755 --- a/core/src/main/java/org/springframework/security/ui/preauth/j2ee/WebXmlMappableRolesRetriever.java +++ b/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; /** *

- * 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. *

- * Example on how to configure this MappableRolesRetriever in the Spring + * Example on how to configure this MappableAttributesRetriever in the Spring * configuration file: * *

  *
  *
- * <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>
  * </bean>
  * <bean id="webXmlResource" class="org.springframework.web.context.support.ServletContextResource">
@@ -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);
     }
 
diff --git a/core/src/test/java/org/springframework/security/rolemapping/SimpleMappableRolesRetrieverTests.java b/core/src/test/java/org/springframework/security/authoritymapping/SimpleMappableRolesRetrieverTests.java
similarity index 74%
rename from core/src/test/java/org/springframework/security/rolemapping/SimpleMappableRolesRetrieverTests.java
rename to core/src/test/java/org/springframework/security/authoritymapping/SimpleMappableRolesRetrieverTests.java
index 4223fcd872..14ce42c7b3 100755
--- a/core/src/test/java/org/springframework/security/rolemapping/SimpleMappableRolesRetrieverTests.java
+++ b/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)
diff --git a/core/src/test/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapperTests.java b/core/src/test/java/org/springframework/security/authoritymapping/SimpleRoles2GrantedAuthoritiesMapperTests.java
similarity index 75%
rename from core/src/test/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapperTests.java
rename to core/src/test/java/org/springframework/security/authoritymapping/SimpleRoles2GrantedAuthoritiesMapperTests.java
index b37eced405..f6422407c5 100755
--- a/core/src/test/java/org/springframework/security/rolemapping/SimpleRoles2GrantedAuthoritiesMapperTests.java
+++ b/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);
diff --git a/core/src/test/java/org/springframework/security/rolemapping/XmlMappableRolesRetrieverTests.java b/core/src/test/java/org/springframework/security/authoritymapping/XmlMappableRolesRetrieverTests.java
similarity index 74%
rename from core/src/test/java/org/springframework/security/rolemapping/XmlMappableRolesRetrieverTests.java
rename to core/src/test/java/org/springframework/security/authoritymapping/XmlMappableRolesRetrieverTests.java
index 684714a98e..f15a03fad1 100755
--- a/core/src/test/java/org/springframework/security/rolemapping/XmlMappableRolesRetrieverTests.java
+++ b/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 {
diff --git a/core/src/test/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java b/core/src/test/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java
index 85112e3fa2..21466ff193 100755
--- a/core/src/test/java/org/springframework/security/ui/preauth/j2ee/J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests.java
+++ b/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);
diff --git a/core/src/test/java/org/springframework/security/ui/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java b/core/src/test/java/org/springframework/security/ui/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java
index cd85acacf0..c0f3bc05ee 100755
--- a/core/src/test/java/org/springframework/security/ui/preauth/j2ee/WebXmlJ2eeDefinedRolesRetrieverTests.java
+++ b/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);
 	}
 }
diff --git a/samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml b/samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml
index 2614547e14..6cb871c3aa 100644
--- a/samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml
+++ b/samples/preauth/src/main/webapp/WEB-INF/applicationContext-security.xml
@@ -65,11 +65,11 @@
         
     
 
-	
+	
 	    
     
 
-	
+