authentication-success-handler-refThis can be used as an alternative to default-target-url
and always-use-default-target, giving you full control over
- the navigation flow after a successful authentication. The value should be he
+ the navigation flow after a successful authentication. The value should be the
name of an AuthenticationSuccessHandler bean in
- the application context.
+ the application context. By default, an imlementation of
+ SavedRequestAwareAuthenticationSuccessHandler is used and
+ injected with the default-target-url.
authentication-failure-handler-ref
@@ -431,10 +433,10 @@
Similar to <form-login> and has the same attributes. The
default value for login-processing-url is
"/j_spring_openid_security_check". An
- OpenIDAuthenticationFilter and
- OpenIDAuthenticationProvider will be registered. The
- latter requires a reference to a UserDetailsService.
- Again, this can be specified by Id, using the user-service-ref
+ OpenIDAuthenticationFilter and
+ OpenIDAuthenticationProvider will be registered. The latter
+ requires a reference to a UserDetailsService. Again,
+ this can be specified by Id, using the user-service-ref
attribute, or will be located automatically in the application context. The <attribute-exchange> Element
diff --git a/docs/manual/src/docbook/core-filters.xml b/docs/manual/src/docbook/core-filters.xml
index 4c9680920c..9c0fae5828 100644
--- a/docs/manual/src/docbook/core-filters.xml
+++ b/docs/manual/src/docbook/core-filters.xml
@@ -292,7 +292,9 @@ class="org.springframework.security.web.context.SecurityContextPersistenceFilter
SavedRequestAwareAuthenticationSuccessHandler,
SimpleUrlAuthenticationFailureHandler and
ExceptionMappingAuthenticationFailureHandler. Have a look at
- the Javadoc for these classes to see how they work.
+ the Javadoc for these classes and also for AbstractAuthenticationProcessingFilter
+ to get an overview of how they work and the supported features.
+
If authentication is successful, the resulting
Authentication object will be placed into the
SecurityContextHolder. The configured
diff --git a/docs/manual/src/docbook/namespace-config.xml b/docs/manual/src/docbook/namespace-config.xml
index 2e1f61be89..5f245a48a2 100644
--- a/docs/manual/src/docbook/namespace-config.xml
+++ b/docs/manual/src/docbook/namespace-config.xml
@@ -294,8 +294,8 @@
Setting a Default Post-Login Destination If a form login isn't prompted by an attempt to access a protected
resource, the default-target-url option comes into play.
- This is the URL the user will be taken to after logging in, and defaults to
- "/". You can also configure things so that they user
+ This is the URL the user will be taken to after successfully logging in, and
+ defaults to "/". You can also configure things so that the user
always ends up at this page (regardless of whether the
login was "on-demand" or they explicitly chose to log in) by setting the
always-use-default-target attribute to "true". This is
@@ -307,8 +307,15 @@
- ]]>
-
+ ]]>
+ For even more control over the destination, you can use the
+ authentication-success-handler-ref attribute as an
+ alternative to default-target-url. The referenced bean
+ should be an instance of
+ AuthenticationSuccessHandler. You'll find
+ more on this in the Core
+ Filters chapter and also in the namespace appendix, as well as
+ information on how to customize the flow when authentication fails.
@@ -548,27 +555,26 @@
]]>The type of each OpenID attribute is a URI,
determined by a particular schema, in this case http://axschema.org/. If an
- attribute must be retrieved for successful authentication, the
- required attribute can be set. The exact schema and
- attributes supported will depend on your OpenID provider. The attribute values
- are returned as part of the authentication process and can be accessed
- afterwards using the following code:
+ xlink:href="http://axschema.org/">http://axschema.org/. If an attribute
+ must be retrieved for successful authentication, the required
+ attribute can be set. The exact schema and attributes supported will depend on
+ your OpenID provider. The attribute values are returned as part of the
+ authentication process and can be accessed afterwards using the following code:
OpenIDAuthenticationToken token =
(OpenIDAuthenticationToken)SecurityContextHolder.getContext().getAuthentication();
List<OpenIDAttribute> attributes = token.getAttributes();The
- OpenIDAttribute contains the attribute type and the
+ OpenIDAttribute contains the attribute type and the
retrieved value (or values in the case of multi-valued attributes). We'll see
more about how the SecurityContextHolder class is used
when we look at core Spring Security components in the technical overview chapter. Multiple
+ xlink:href="core-components">technical overview chapter. Multiple
attribute exchange configurations are also be supported, if you wish to use
multiple identity providers. You can supply multiple
- attribute-exchange elements, using an
- identifier-matcher attribute on each. This contains a
- regular expression which will be matched against the OpenID identifier supplied
- by the user. See the OpenID sample application in the codebase for an example
+ attribute-exchange elements, using an
+ identifier-matcher attribute on each. This contains a regular
+ expression which will be matched against the OpenID identifier supplied by the
+ user. See the OpenID sample application in the codebase for an example
configuration, providing different attribute lists for the Google, Yahoo and
MyOpenID providers.
diff --git a/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java b/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
index c30f2fbefe..bc6c860300 100644
--- a/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
+++ b/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
@@ -31,7 +31,7 @@ import org.springframework.util.StringUtils;
*
*
* If a parameter matching the targetUrlParameter has been set on the request, the value will be used as
- * the destination.
+ * the destination. The default parameter name is {@code spring-security-redirect}.
*
*
* If the useReferer property is set, the "Referer" HTTP header value will be used, if present.