Hi all,
I am using openId authentication with Spring Security 3.0.5.RELEASE, but I can't make my user be redirected to its inital url after authentication.
In my case, the initial url (before auth) is http://localhost:8080/my-web-app/admin/shop, but the user is always redirected to root.
It is a valid url, and always-use-default-target is set to false.
I am using the following security configuration:
======Code:<http auto-config='true' use-expressions="true"> <intercept-url pattern="/admin/security/**" access="hasRole('SUPER_ADMIN')" /> <intercept-url pattern="/direct/admin/security/**" access="hasRole('SUPER_ADMIN')" /> <intercept-url pattern="/admin/**" access="hasAnyRole('ADMIN','SUPER_ADMIN')" /> <intercept-url pattern="/direct/admin/**" access="hasAnyRole('ADMIN','SUPER_ADMIN')" /> <logout logout-url="/logout" /> <openid-login login-page="/login" user-service-ref="openIdUserDetailsService" authentication-success-handler-ref="openIDAuthenticationSuccessHandler" always-use-default-target="false"> <attribute-exchange> <openid-attribute name="email" type="http://axschema.org/contact/email" required="true" /> <openid-attribute name="oiContactEmail" type="http://schema.openid.net/contact/email" required="true" /> <openid-attribute name="fullname" type="http://axschema.org/namePerson" required="true" /> <openid-attribute name="nickname" type="http://axschema.org/namePerson/friendly" required="true" /> <openid-attribute name="axNamePersonFirstName" type="http://axschema.org/namePerson/first" required="true" /> <openid-attribute name="axNamePersonLastName" type="http://axschema.org/namePerson/last" required="true" /> <openid-attribute name="image" type="http://axschema.org/media/image/default" required="true" /> <openid-attribute name="language" type="http://axschema.org/pref/language" required="true" /> <openid-attribute name="country" type="http://axschema.org/contact/country/home" required="true" /> </attribute-exchange> </openid-login> </http>
User roles are setted in my bean openIDAuthenticationSuccessHandler implementing SimpleUrlAuthenticationSuccessHandler, could it be too late?
If yes, is there an other way?
=======
SimpleUrlAuthenticationSuccessHandler herit from AbstractAuthenticationTargetUrlRequestHandler, and in method determineTargetUrl:
... targetUrl is null.Code:protected String determineTargetUrl(HttpServletRequest request, HttpServletResponse response) { if (isAlwaysUseDefaultTargetUrl()) { return defaultTargetUrl; } // Check for the parameter and use that if available String targetUrl = request.getParameter(targetUrlParameter);
The parameter name is "spring-security-redirect". Where is this request parameter supposed to be set?


Reply With Quote
