SEC-1132: Move authoritymapping to core as it is actually used in loading authorities for a use, not in making access decisions.

This commit is contained in:
Luke Taylor 2009-04-14 04:22:57 +00:00
parent 769041474e
commit c770998d92
20 changed files with 32 additions and 34 deletions

View File

@ -30,7 +30,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
* <p> * <p>
* Once the request has been authenticated, the <tt>Authentication</tt> will usually be stored in a thread-local * Once the request has been authenticated, the <tt>Authentication</tt> will usually be stored in a thread-local
* <tt>SecurityContext</tt> managed by the {@link SecurityContextHolder} by the authentication mechanism which is * <tt>SecurityContext</tt> managed by the {@link SecurityContextHolder} by the authentication mechanism which is
* being used. An explicit authentication can be achieved, without using one of Spring Security's authentication * being used. An explicit authentication can be achieved, without using one of Spring Security's authentication
* mechanisms, by creating an <tt>Authentication</tt> instance and using the code: * mechanisms, by creating an <tt>Authentication</tt> instance and using the code:
* *
* <pre> * <pre>
@ -38,7 +38,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
* </pre> * </pre>
* Note that unless the <tt>Authentication</tt> has the <tt>authenticated</tt> property set to <tt>true</tt>, it will * Note that unless the <tt>Authentication</tt> has the <tt>authenticated</tt> property set to <tt>true</tt>, it will
* still be authenticated by any security interceptor (for method or web invocations) which encounters it. * still be authenticated by any security interceptor (for method or web invocations) which encounters it.
* * <p>
* In most cases, the framework transparently takes care of managing the security context and authentication objects * In most cases, the framework transparently takes care of managing the security context and authentication objects
* for you. * for you.
* *

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -144,7 +144,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements Attributes2G
/** /**
* *
* @see org.springframework.security.access.authoritymapping.MappableAttributesRetriever#getMappableAttributes() * @see org.springframework.security.core.authoritymapping.MappableAttributesRetriever#getMappableAttributes()
*/ */
public Set<String> getMappableAttributes() { public Set<String> getMappableAttributes() {
return mappableAttributes; return mappableAttributes;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.util.Set; import java.util.Set;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.GrantedAuthorityImpl; import org.springframework.security.core.GrantedAuthorityImpl;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -18,7 +18,7 @@ public class SimpleMappableAttributesRetriever implements MappableAttributesRetr
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.springframework.security.access.authoritymapping.MappableAttributesRetriever#getMappableAttributes() * @see org.springframework.security.core.authoritymapping.MappableAttributesRetriever#getMappableAttributes()
*/ */
public Set<String> getMappableAttributes() { public Set<String> getMappableAttributes() {
return mappableAttributes; return mappableAttributes;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.io.FilterInputStream; import java.io.FilterInputStream;
import java.io.IOException; import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -11,10 +11,10 @@ import java.util.List;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.Test; import org.junit.Test;
import org.springframework.security.access.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.access.authoritymapping.MapBasedAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.GrantedAuthorityImpl; import org.springframework.security.core.GrantedAuthorityImpl;
import org.springframework.security.core.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.authoritymapping.MapBasedAttributes2GrantedAuthoritiesMapper;
/** /**
* *

View File

@ -1,9 +1,10 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.util.Set; import java.util.Set;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.springframework.security.core.authoritymapping.SimpleMappableAttributesRetriever;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/** /**

View File

@ -1,7 +1,7 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -1,4 +1,4 @@
package org.springframework.security.access.authoritymapping; package org.springframework.security.core.authoritymapping;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
@ -7,7 +7,7 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import org.springframework.security.access.authoritymapping.XmlMappableAttributesRetriever; import org.springframework.security.core.authoritymapping.XmlMappableAttributesRetriever;
import junit.framework.TestCase; import junit.framework.TestCase;

View File

@ -18,8 +18,6 @@ package org.springframework.security.core.context;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.security.core.context.SecurityContextImpl;
/** /**

View File

@ -20,7 +20,6 @@ import junit.framework.TestCase;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.security.core.context.SecurityContextImpl;

View File

@ -36,7 +36,7 @@
<property name="authenticationDetailsSource"> <property name="authenticationDetailsSource">
<bean class="org.springframework.security.portlet.PortletPreAuthenticatedAuthenticationDetailsSource"> <bean class="org.springframework.security.portlet.PortletPreAuthenticatedAuthenticationDetailsSource">
<property name="mappableRolesRetriever"> <property name="mappableRolesRetriever">
<bean class="org.springframework.security.access.authoritymapping.SimpleMappableAttributesRetriever"> <bean class="org.springframework.security.core.authoritymapping.SimpleMappableAttributesRetriever">
<property name="mappableAttributes"> <property name="mappableAttributes">
<set> <set>
<value>tomcat</value> <value>tomcat</value>

View File

@ -52,7 +52,7 @@
<property name="userRoles2GrantedAuthoritiesMapper" ref="j2eeUserRoles2GrantedAuthoritiesMapper"/> <property name="userRoles2GrantedAuthoritiesMapper" ref="j2eeUserRoles2GrantedAuthoritiesMapper"/>
</bean> </bean>
<bean id="j2eeUserRoles2GrantedAuthoritiesMapper" class="org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper"> <bean id="j2eeUserRoles2GrantedAuthoritiesMapper" class="org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper">
<property name="convertAttributeToUpperCase" value="true"/> <property name="convertAttributeToUpperCase" value="true"/>
</bean> </bean>

View File

@ -6,12 +6,12 @@ import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.security.access.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.access.authoritymapping.MappableAttributesRetriever;
import org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.authentication.AuthenticationDetailsSourceImpl; import org.springframework.security.authentication.AuthenticationDetailsSourceImpl;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.MutableGrantedAuthoritiesContainer; import org.springframework.security.core.MutableGrantedAuthoritiesContainer;
import org.springframework.security.core.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.authoritymapping.MappableAttributesRetriever;
import org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**

View File

@ -1,7 +1,7 @@
package org.springframework.security.web.authentication.preauth.j2ee; package org.springframework.security.web.authentication.preauth.j2ee;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails; import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
import org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper; import org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -2,7 +2,7 @@ package org.springframework.security.web.authentication.preauth.j2ee;
import java.io.InputStream; import java.io.InputStream;
import org.springframework.security.access.authoritymapping.XmlMappableAttributesRetriever; import org.springframework.security.core.authoritymapping.XmlMappableAttributesRetriever;
/** /**
* <p> * <p>

View File

@ -6,11 +6,11 @@ import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.access.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.authentication.AuthenticationDetailsSourceImpl; import org.springframework.security.authentication.AuthenticationDetailsSourceImpl;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.MutableGrantedAuthoritiesContainer; import org.springframework.security.core.MutableGrantedAuthoritiesContainer;
import org.springframework.security.core.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesAuthenticationDetails; import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesAuthenticationDetails;
import org.springframework.util.Assert; import org.springframework.util.Assert;

View File

@ -10,11 +10,11 @@ import javax.servlet.http.HttpServletRequest;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.springframework.security.access.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.access.authoritymapping.MappableAttributesRetriever;
import org.springframework.security.access.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.access.authoritymapping.SimpleMappableAttributesRetriever;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.authoritymapping.MappableAttributesRetriever;
import org.springframework.security.core.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.core.authoritymapping.SimpleMappableAttributesRetriever;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails; import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
import org.springframework.security.web.authentication.preauth.j2ee.J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource; import org.springframework.security.web.authentication.preauth.j2ee.J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource;