Author: violetagg Date: Sat Feb 11 09:48:18 2017 New Revision: 1782566 URL: http://svn.apache.org/viewvc?rev=1782566&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60720 Replace "WWW-Authenticate" literal with static final AUTH_HEADER_NAME in SpnegoAuthenticator. Patch provided by Michael Osipov.
Modified: tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java?rev=1782566&r1=1782565&r2=1782566&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java (original) +++ tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java Sat Feb 11 09:48:18 2017 @@ -149,7 +149,7 @@ public class SpnegoAuthenticator extends if (log.isDebugEnabled()) { log.debug(sm.getString("authenticator.noAuthHeader")); } - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } @@ -162,7 +162,7 @@ public class SpnegoAuthenticator extends log.debug(sm.getString( "spnegoAuthenticator.authHeaderNotNego")); } - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } @@ -182,7 +182,7 @@ public class SpnegoAuthenticator extends log.debug(sm.getString( "spnegoAuthenticator.authHeaderNoToken")); } - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } @@ -235,7 +235,7 @@ public class SpnegoAuthenticator extends "spnegoAuthenticator.ticketValidateFail")); } // Start again - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } @@ -247,7 +247,7 @@ public class SpnegoAuthenticator extends if (log.isDebugEnabled()) { log.debug(sm.getString("spnegoAuthenticator.ticketValidateFail"), e); } - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } catch (PrivilegedActionException e) { @@ -259,7 +259,7 @@ public class SpnegoAuthenticator extends } else { log.error(sm.getString("spnegoAuthenticator.serviceLoginFail"), e); } - response.setHeader("WWW-Authenticate", "Negotiate"); + response.setHeader(AUTH_HEADER_NAME, "Negotiate"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return false; } finally { @@ -280,7 +280,7 @@ public class SpnegoAuthenticator extends } // Send response token on success and failure - response.setHeader("WWW-Authenticate", "Negotiate " + response.setHeader(AUTH_HEADER_NAME, "Negotiate " + Base64.encodeBase64String(outToken)); if (principal != null) { Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1782566&r1=1782565&r2=1782566&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Sat Feb 11 09:48:18 2017 @@ -70,6 +70,11 @@ <bug>60683</bug>: Security manager failure causing NPEs when doing IO on some JVMs. (coty) </fix> + <fix> + <bug>60720</bug>: Replace "WWW-Authenticate" literal with static final + AUTH_HEADER_NAME in SpnegoAuthenticator. Patch provided by Michael + Osipov. (violetagg) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org