Explorar el Código

SEC-1010: Moved TestingAuthenticationProvider and token to main core src tree and updated poms to match

Luke Taylor hace 17 años
padre
commit
c947d42146

+ 2 - 0
acl/pom.xml

@@ -17,6 +17,7 @@
             <artifactId>spring-security-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+<!--        
         <dependency>
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-core</artifactId>
@@ -24,6 +25,7 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+-->        
         <dependency>
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-core</artifactId>

+ 4 - 7
core/src/test/java/org/springframework/security/providers/TestingAuthenticationProvider.java → core/src/main/java/org/springframework/security/providers/TestingAuthenticationProvider.java

@@ -22,8 +22,9 @@ import org.springframework.security.AuthenticationException;
 /**
  * An {@link AuthenticationProvider} implementation for the  {@link TestingAuthenticationToken}.<p>It simply
  * accepts as valid whatever is contained within the <code>TestingAuthenticationToken</code>.</p>
- *  <p>The purpose of this implementation is to facilitate unit testing. This provider should <B>never be enabled
- * on a production system</b>.</p>
+ * <p>
+ * The purpose of this implementation is to facilitate unit testing. This provider should <b>never be enabled
+ * on a production system</b>.
  *
  * @author Ben Alex
  * @version $Id$
@@ -37,10 +38,6 @@ public class TestingAuthenticationProvider implements AuthenticationProvider {
     }
 
     public boolean supports(Class authentication) {
-        if (TestingAuthenticationToken.class.isAssignableFrom(authentication)) {
-            return true;
-        } else {
-            return false;
-        }
+        return TestingAuthenticationToken.class.isAssignableFrom(authentication);
     }
 }

+ 9 - 8
core/src/test/java/org/springframework/security/providers/TestingAuthenticationToken.java → core/src/main/java/org/springframework/security/providers/TestingAuthenticationToken.java

@@ -20,8 +20,9 @@ import org.springframework.security.util.AuthorityUtils;
 
 
 /**
- * An {@link org.springframework.security.Authentication} implementation that is designed for use whilst unit testing.<p>The
- * corresponding authentication provider is  {@link TestingAuthenticationProvider}.</p>
+ * An {@link org.springframework.security.Authentication} implementation that is designed for use whilst unit testing.
+ * <p>
+ * The corresponding authentication provider is  {@link TestingAuthenticationProvider}.
  *
  * @author Ben Alex
  * @version $Id$
@@ -36,15 +37,15 @@ public class TestingAuthenticationToken extends AbstractAuthenticationToken {
     //~ Constructors ===================================================================================================
 
     public TestingAuthenticationToken(Object principal, Object credentials) {
-    	super(null);
+        super(null);
         this.principal = principal;
-        this.credentials = credentials;    	
-    }    
+        this.credentials = credentials;
+    }
+
 
-    
     public TestingAuthenticationToken(Object principal, Object credentials, String... authorities) {
-    	this(principal, credentials, AuthorityUtils.stringArrayToAuthorityArray(authorities));
-    }    
+        this(principal, credentials, AuthorityUtils.stringArrayToAuthorityArray(authorities));
+    }
 
     public TestingAuthenticationToken(Object principal, Object credentials, GrantedAuthority[] authorities) {
         super(authorities);

+ 0 - 7
portlet/pom.xml

@@ -14,13 +14,6 @@
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-core</artifactId>
             <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-core</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
         </dependency>                
         <dependency>
             <groupId>javax.servlet</groupId>

+ 0 - 7
sandbox/captcha/pom.xml

@@ -16,13 +16,6 @@
             <artifactId>spring-security-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-core</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>

+ 0 - 6
sandbox/other/pom.xml

@@ -17,12 +17,6 @@
       <artifactId>spring-security-core</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.springframework.security</groupId>
-      <artifactId>spring-security-core</artifactId>
-      <classifier>tests</classifier>
-      <version>${project.version}</version>
-    </dependency>    
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test</artifactId>

+ 0 - 7
taglibs/pom.xml

@@ -18,13 +18,6 @@
             <artifactId>spring-security-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-core</artifactId>
-            <version>${project.version}</version>
-            <classifier>tests</classifier>
-            <scope>test</scope>
-        </dependency>        
         <dependency>
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-acl</artifactId>