Skip to content

Commit

Permalink
In FormAuthenticator: If it is configured to change Session IDs,
Browse files Browse the repository at this point in the history
do the change before displaying the login form.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1408043 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Konstantin Kolinko committed Nov 11, 2012
1 parent 8fea85c commit 39c4263
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions java/org/apache/catalina/authenticator/FormAuthenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.Manager;
import org.apache.catalina.Realm;
import org.apache.catalina.Session;
import org.apache.catalina.connector.Request;
Expand Down Expand Up @@ -381,6 +382,15 @@ protected void forwardToLoginPage(Request request,
return;
}

if (getChangeSessionIdOnAuthentication()) {
Session session = request.getSessionInternal(false);
if (session != null) {
Manager manager = request.getContext().getManager();
manager.changeSessionId(session);
request.changeSessionId(session.getId());
}
}

// Always use GET for the login page, regardless of the method used
String oldMethod = request.getMethod();
request.getCoyoteRequest().method().setString("GET");
Expand Down

0 comments on commit 39c4263

Please sign in to comment.