Просмотр исходного кода

Removed unused import in DelegatingAuthenticationEntryPoint and corrected test class name.

Luke Taylor 15 лет назад
Родитель
Сommit
c1133d1ef3

+ 10 - 13
web/src/main/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPoint.java

@@ -17,7 +17,6 @@ package org.springframework.security.web.authentication;
 
 import java.io.IOException;
 import java.util.LinkedHashMap;
-import java.util.Map;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -34,27 +33,25 @@ import org.springframework.util.Assert;
 /**
  * An AuthenticationEntryPoint which selects a concrete EntryPoint based on a
  * RequestMatcher evaluation.
- * 
+ *
  * <p>A configuration might look like this:</p>
- * 
+ *
  * <pre>
  * &lt;bean id=&quot;daep&quot; class=&quot;org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint&quot;&gt;
  *     &lt;constructor-arg&gt;
  *         &lt;map&gt;
  *             &lt;entry key=&quot;hasIpAddress('192.168.1.0/24') and hasHeader('User-Agent','Mozilla')&quot; value-ref=&quot;firstAEP&quot; /&gt;
- *             &lt;entry key=&quot;hasHeader('User-Agent','MSIE')&quot; value-ref=&quot;secondAEP&quot; /&gt; 
+ *             &lt;entry key=&quot;hasHeader('User-Agent','MSIE')&quot; value-ref=&quot;secondAEP&quot; /&gt;
  *         &lt;/map&gt;
  *     &lt;/constructor-arg&gt;
  *     &lt;property name=&quot;defaultEntryPoint&quot; ref=&quot;defaultAEP&quot;/&gt;
  * &lt;/bean&gt;
  * </pre>
- * 
+ *
  * This example uses the {@link RequestMatcherEditor} which creates {@link ELRequestMatcher} instances for the map keys.
- * 
- * 
+ *
  * @author Mike Wiesner
  * @since 3.0.2
- * @version $Id:$
  */
 public class DelegatingAuthenticationEntryPoint implements
         AuthenticationEntryPoint, InitializingBean {
@@ -84,17 +81,17 @@ public class DelegatingAuthenticationEntryPoint implements
             {
                entryPoints.get(requestMatcher).commence(request, response, authException);
                return;
-            }   
+            }
         }
-        
+
         // No EntryPoint matched, use defaultEntryPoint
         defaultEntryPoint.commence(request, response, authException);
     }
 
     public void afterPropertiesSet() throws Exception {
        Assert.notEmpty(entryPoints, "entryPoints must be specified");
-       Assert.notNull(defaultEntryPoint, "defaultEntryPoint must be specified");  
+       Assert.notNull(defaultEntryPoint, "defaultEntryPoint must be specified");
     }
-    
-    
+
+
 }

+ 3 - 4
web/src/test/java/org/springframework/security/web/authentication/DelegatinAuthenticationEntryPointContextTest.java → web/src/test/java/org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointContextTest.java

@@ -1,6 +1,5 @@
 package org.springframework.security.web.authentication;
 
-import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -19,7 +18,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = "classpath:org/springframework/security/web/authentication/DelegatingAuthenticationEntryPointTest-context.xml")
-public class DelegatinAuthenticationEntryPointContextTest {
+public class DelegatingAuthenticationEntryPointContextTest {
 
     @Autowired
     private DelegatingAuthenticationEntryPoint daep;
@@ -40,7 +39,7 @@ public class DelegatinAuthenticationEntryPointContextTest {
         request.addHeader("User-Agent", "Mozilla/5.0");
         daep.commence(request, null, null);
         verify(firstAEP).commence(request, null, null);
-        verify(defaultAEP, never()).commence(any(HttpServletRequest.class), 
+        verify(defaultAEP, never()).commence(any(HttpServletRequest.class),
                 any(HttpServletResponse.class),
                 any(AuthenticationException.class));
 
@@ -53,7 +52,7 @@ public class DelegatinAuthenticationEntryPointContextTest {
         request.setRemoteAddr("192.168.1.10");
         daep.commence(request, null, null);
         verify(defaultAEP).commence(request, null, null);
-        verify(firstAEP, never()).commence(any(HttpServletRequest.class), 
+        verify(firstAEP, never()).commence(any(HttpServletRequest.class),
                 any(HttpServletResponse.class),
                 any(AuthenticationException.class));