diff --git a/core/src/main/java/org/acegisecurity/ui/webapp/AuthenticationProcessingFilter.java b/core/src/main/java/org/acegisecurity/ui/webapp/AuthenticationProcessingFilter.java index a4414585d6..899166fd39 100644 --- a/core/src/main/java/org/acegisecurity/ui/webapp/AuthenticationProcessingFilter.java +++ b/core/src/main/java/org/acegisecurity/ui/webapp/AuthenticationProcessingFilter.java @@ -50,6 +50,7 @@ public class AuthenticationProcessingFilter extends AbstractProcessingFilter { public static final String ACEGI_SECURITY_FORM_USERNAME_KEY = "j_username"; public static final String ACEGI_SECURITY_FORM_PASSWORD_KEY = "j_password"; + public static final String ACEGI_SECURITY_LAST_USERNAME_KEY = "ACEGI_SECURITY_LAST_USERNAME"; //~ Methods ================================================================ @@ -81,6 +82,10 @@ public class AuthenticationProcessingFilter extends AbstractProcessingFilter { // Allow subclasses to set the "details" property setDetails(request, authRequest); + // Place the last username attempted into HttpSession for views + request.getSession().setAttribute(ACEGI_SECURITY_LAST_USERNAME_KEY, + username); + return this.getAuthenticationManager().authenticate(authRequest); } diff --git a/samples/contacts/src/main/webapp/filter/acegilogin.jsp b/samples/contacts/src/main/webapp/filter/acegilogin.jsp index 0cfe866dd7..caf60a6934 100644 --- a/samples/contacts/src/main/webapp/filter/acegilogin.jsp +++ b/samples/contacts/src/main/webapp/filter/acegilogin.jsp @@ -1,5 +1,6 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %> <%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %> +<%@ page import="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter" %> <%@ page import="net.sf.acegisecurity.AuthenticationException" %> @@ -30,7 +31,7 @@
- +
User:
User:value='<%= session.getAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY) %>'>
Password: