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