Permalink
Browse files

Going to saved RedirectUrl now works after login.

  • Loading branch information...
1 parent d393c68 commit e494650a5899ed750e2203fcb534cbd86c2d95bc @hirokiterashima hirokiterashima committed May 21, 2012
@@ -35,6 +35,8 @@
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
+import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
+import org.springframework.security.web.savedrequest.SavedRequest;
import org.springframework.util.StringUtils;
import org.telscenter.sail.webapp.domain.authentication.MutableUserDetails;
import org.telscenter.sail.webapp.domain.authentication.impl.StudentUserDetails;
@@ -117,7 +119,10 @@ else if (userDetails instanceof TeacherUserDetails) {
}
/* redirect if specified in the login request */
- String redirectUrl = request.getParameter("redirect");
+ SavedRequest savedRequest =
+ new HttpSessionRequestCache().getRequest(request, response);
+ String redirectUrl = savedRequest.getRedirectUrl();
+ //String redirectUrl = request.getParameter("redmrect");
if(StringUtils.hasText(redirectUrl)){
this.setDefaultTargetUrl(redirectUrl);
}

0 comments on commit e494650

Please sign in to comment.