Last active
August 29, 2015 14:08
-
-
Save jenslohmann/56a810a2addcd2250b3b to your computer and use it in GitHub Desktop.
Patch for JBoss 6.1.0.Final (or rather its JBossWeb 3.0.0.CR2) to return a crippled WWW-Authenticate header for XMLHttpRequests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: org/apache/catalina/authenticator/BasicAuthenticator.java | |
<+>UTF-8 | |
=================================================================== | |
--- org/apache/catalina/authenticator/BasicAuthenticator.java (revision ) | |
+++ org/apache/catalina/authenticator/BasicAuthenticator.java (revision ) | |
@@ -191,6 +191,11 @@ | |
request.getResponse().getCoyoteResponse().getMimeHeaders() | |
.addValue(AUTHENTICATE_BYTES, 0, AUTHENTICATE_BYTES.length); | |
CharChunk authenticateCC = authenticate.getCharChunk(); | |
+ MessageBytes xRequestedWith = | |
+ request.getCoyoteRequest().getMimeHeaders().getValue("x-requested-with"); | |
+ if(xRequestedWith != null && xRequestedWith.equals("XMLHttpRequest")) { | |
+ authenticateCC.append('x'); | |
+ } | |
authenticateCC.append("Basic realm=\""); | |
if (config.getRealmName() == null) { | |
authenticateCC.append("Realm"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment