mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 14:52:24 +00:00
SEC-295: Changed to use getDefaultTargetUrl() accessor internally rather than accessing property directly. Allows for overriding method to supply different Urls.
This commit is contained in:
parent
9fd0bbd694
commit
2a7caff95f
@ -81,14 +81,15 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
* <p>To configure this filter to redirect to specific pages as the result of specific {@link
|
* <p>To configure this filter to redirect to specific pages as the result of specific {@link
|
||||||
* AuthenticationException}s you can do the following. Configure the <code>exceptionMappings</code> property in your
|
* AuthenticationException}s you can do the following. Configure the <code>exceptionMappings</code> property in your
|
||||||
* application xml. This property is a java.util.Properties object that maps a fully-qualified exception class name to
|
* application xml. This property is a java.util.Properties object that maps a fully-qualified exception class name to
|
||||||
* a redirection url target.<br>
|
* a redirection url target.
|
||||||
* For example:<br>
|
* For example:
|
||||||
* <code> <property name="exceptionMappings"><br>
|
* <pre>
|
||||||
* * <props><br>
|
* <property name="exceptionMappings">
|
||||||
* * <prop> key="org.acegisecurity.BadCredentialsException">/bad_credentials.jsp</prop><br>
|
* <props>
|
||||||
* * </props><br>
|
* <prop> key="org.acegisecurity.BadCredentialsException">/bad_credentials.jsp</prop>
|
||||||
* * </property><br>
|
* </props>
|
||||||
* * </code><br>
|
* </property>
|
||||||
|
* </pre>
|
||||||
* The example above would redirect all {@link org.acegisecurity.BadCredentialsException}s thrown, to a page in the
|
* The example above would redirect all {@link org.acegisecurity.BadCredentialsException}s thrown, to a page in the
|
||||||
* web-application called /bad_credentials.jsp.</p>
|
* web-application called /bad_credentials.jsp.</p>
|
||||||
* <p>Any {@link AuthenticationException} thrown that cannot be matched in the <code>exceptionMappings</code> will
|
* <p>Any {@link AuthenticationException} thrown that cannot be matched in the <code>exceptionMappings</code> will
|
||||||
@ -122,7 +123,7 @@ public abstract class AbstractProcessingFilter implements Filter, InitializingBe
|
|||||||
private String authenticationFailureUrl;
|
private String authenticationFailureUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where to redirect the browser to if authentication is successful but ACEGI_SECURITY_TARGET_URL_KEY is
|
* Where to redirect the browser to if authentication is successful but ACEGI_SAVED_REQUEST_KEY is
|
||||||
* <code>null</code>
|
* <code>null</code>
|
||||||
*/
|
*/
|
||||||
private String defaultTargetUrl;
|
private String defaultTargetUrl;
|
||||||
@ -134,7 +135,7 @@ public abstract class AbstractProcessingFilter implements Filter, InitializingBe
|
|||||||
private String filterProcessesUrl = getDefaultFilterProcessesUrl();
|
private String filterProcessesUrl = getDefaultFilterProcessesUrl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If <code>true</code>, will always redirect to {@link #defaultTargetUrl} upon successful authentication,
|
* If <code>true</code>, will always redirect to the value of {@link #getDefaultTargetUrl} upon successful authentication,
|
||||||
* irrespective of the page that caused the authentication request (defaults to <code>false</code>).
|
* irrespective of the page that caused the authentication request (defaults to <code>false</code>).
|
||||||
*/
|
*/
|
||||||
private boolean alwaysUseDefaultTargetUrl = false;
|
private boolean alwaysUseDefaultTargetUrl = false;
|
||||||
@ -231,6 +232,14 @@ public abstract class AbstractProcessingFilter implements Filter, InitializingBe
|
|||||||
*/
|
*/
|
||||||
public abstract String getDefaultFilterProcessesUrl();
|
public abstract String getDefaultFilterProcessesUrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supplies the default target Url that will be used if no saved request is found or the
|
||||||
|
* <tt>alwaysUseDefaultTargetUrl</tt> propert is set to true.
|
||||||
|
* Override this method of you want to provide a customized default Url (for example if you want different Urls
|
||||||
|
* depending on the authorities of the user who has just logged in).
|
||||||
|
*
|
||||||
|
* @return the defaultTargetUrl property
|
||||||
|
*/
|
||||||
public String getDefaultTargetUrl() {
|
public String getDefaultTargetUrl() {
|
||||||
return defaultTargetUrl;
|
return defaultTargetUrl;
|
||||||
}
|
}
|
||||||
@ -377,7 +386,7 @@ public abstract class AbstractProcessingFilter implements Filter, InitializingBe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (targetUrl == null) {
|
if (targetUrl == null) {
|
||||||
targetUrl = request.getContextPath() + defaultTargetUrl;
|
targetUrl = request.getContextPath() + getDefaultTargetUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user