Author: markt
Date: Tue May 31 13:06:11 2011
New Revision: 1129658
URL: http://svn.apache.org/viewvc?rev=1129658&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51277
Improve error message if an application is deployed with an incomplete FORM
authentication configuration.
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
tomcat/trunk/java/org/apache/catalina/authenticator/LocalStrings.properties
tomcat/trunk/webapps/docs/changelog.xml
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java?rev=1129658&r1=1129657&r2=1129658&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
Tue May 31 13:06:11 2011
@@ -365,9 +365,19 @@ public class FormAuthenticator
protected void forwardToLoginPage(Request request,
HttpServletResponse response, LoginConfig config)
throws IOException {
+
+ String loginPage = config.getLoginPage();
+ if (loginPage == null || loginPage.length() == 0) {
+ String msg = sm.getString("formAuthenticator.noLoginPage",
+ context.getName());
+ log.warn(msg);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+ msg);
+ return;
+ }
+
RequestDispatcher disp =
- context.getServletContext().getRequestDispatcher
- (config.getLoginPage());
+ context.getServletContext().getRequestDispatcher(loginPage);
try {
if (context.fireRequestInitEvent(request)) {
disp.forward(request.getRequest(), response);
@@ -398,6 +408,17 @@ public class FormAuthenticator
protected void forwardToErrorPage(Request request,
HttpServletResponse response, LoginConfig config)
throws IOException {
+
+ String errorPage = config.getErrorPage();
+ if (errorPage == null || errorPage.length() == 0) {
+ String msg = sm.getString("formAuthenticator.noErrorPage",
+ context.getName());
+ log.warn(msg);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
+ msg);
+ return;
+ }
+
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getErrorPage());
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/LocalStrings.properties?rev=1129658&r1=1129657&r2=1129658&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/LocalStrings.properties
Tue May 31 13:06:11 2011
@@ -32,6 +32,8 @@ digestAuthenticator.cacheRemove=A valid
formAuthenticator.forwardErrorFail=Unexpected error forwarding to error page
formAuthenticator.forwardLoginFail=Unexpected error forwarding to login page
+formAuthenticator.noErrorPage=No error page was defined for FORM
authentication in context [{0}]
+formAuthenticator.noLoginPage=No login page was defined for FORM
authentication in context [{0}]
spnegoAuthenticator.authHeaderNoToken=The Negotiate authorization header sent
by the client did not include a token
spnegoAuthenticator.authHeaderNotNego=The authorization header sent by the
client did not start with Negotiate
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1129658&r1=1129657&r2=1129658&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue May 31 13:06:11 2011
@@ -67,6 +67,10 @@
<bug>51274</bug>: Add missing i18n strings in PersistentManagerBase.
Patch provided by Eiji Takahashi. (markt)
</fix>
+ <fix>
+ <bug>51277</bug>: Improve error message if an application is deployed
+ with an incomplete FORM authentication configuration. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]