Author: markt
Date: Fri Jul 3 19:20:20 2015
New Revision: 1689069
URL: http://svn.apache.org/r1689069
Log:
Extracted expired session handling
Patch by fjodorver
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java?rev=1689069&r1=1689068&r2=1689069&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
Fri Jul 3 19:20:20 2015
@@ -204,11 +204,12 @@ public class FormAuthModule extends Tomc
// credentials
// and redirect to the error page if they are not correct
request.getResponse().sendAcknowledgement();
- Realm realm = context.getRealm();
+
// TODO fix character encoding
// if (characterEncoding != null) {
// request.setCharacterEncoding(characterEncoding);
// }
+
String username = request.getParameter(Constants.FORM_USERNAME);
String password = request.getParameter(Constants.FORM_PASSWORD);
if (log.isDebugEnabled()) {
@@ -228,25 +229,7 @@ public class FormAuthModule extends Tomc
session = request.getSessionInternal(false);
}
if (session == null) {
- // if (containerLog.isDebugEnabled()) {
- // containerLog.debug
- // ("User took so long to log on the session expired");
- // }
- if (landingPage == null) {
- response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT,
- sm.getString("authenticator.sessionExpired"));
- } else {
- // Make the authenticator think the user originally
- // requested
- // the landing page
- String uri = request.getContextPath() + landingPage;
- SavedRequest saved = new SavedRequest();
- saved.setMethod("GET");
- saved.setRequestURI(uri);
- saved.setDecodedRequestURI(uri);
-
request.getSessionInternal(true).setNote(Constants.FORM_REQUEST_NOTE, saved);
- response.sendRedirect(response.encodeRedirectURL(uri));
- }
+ handleSessionExpired(request, response);
return AuthStatus.FAILURE;
}
@@ -295,6 +278,25 @@ public class FormAuthModule extends Tomc
}
+ private void handleSessionExpired(Request request, HttpServletResponse
response)
+ throws IOException {
+ if (landingPage == null) {
+ response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT,
+ sm.getString("authenticator.sessionExpired"));
+ return;
+ }
+ // Make the authenticator think the user originally
+ // requested
+ // the landing page
+ String uri = request.getContextPath() + landingPage;
+ SavedRequest saved = new SavedRequest();
+ saved.setMethod("GET");
+ saved.setRequestURI(uri);
+ saved.setDecodedRequestURI(uri);
+ request.getSessionInternal(true).setNote(Constants.FORM_REQUEST_NOTE,
saved);
+ }
+
+
private void handlePrincipalCallbacks(Subject clientSubject, Principal
principal)
throws IOException, UnsupportedCallbackException {
CallerPrincipalCallback principalCallback = new
CallerPrincipalCallback(clientSubject,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]