Commit de3a570b authored by Ricki Hirner's avatar Ricki Hirner

Rewrite authentication scheme parameters to lower case

parent fc4bd450
Pipeline #4634343 passed with stage
in 7 minutes and 40 seconds
......@@ -138,12 +138,16 @@ public class BasicDigestAuthHandler implements Authenticator, Interceptor {
params.add("username=" + quotedString(username));
if (realm != null)
params.add("realm=" + quotedString(realm));
else
else {
Constants.log.warning("No realm provided, aborting Digest auth");
return null;
}
if (nonce != null)
params.add("nonce=" + quotedString(nonce));
else
else {
Constants.log.warning("No nonce provided, aborting Digest auth");
return null;
}
if (opaque != null)
params.add("opaque=" + quotedString(opaque));
......
......@@ -119,7 +119,10 @@ public class HttpUtils {
Pattern nameValue = Pattern.compile("^([^=]+)=(.*)$");
public final String name;
/** Map (name -> value) authentication parameters. Names are always lower-case. */
public final Map<String, String> params = new HashMap<>();
public final List<String> unnamedParams = new LinkedList<>();
public void addRawParam(String authParam) {
......@@ -134,7 +137,7 @@ public class HttpUtils {
.substring(1, len-1)
.replace("\\\"", "\"");
}
params.put(name, value);
params.put(name.toLowerCase(), value);
} else
unnamedParams.add(authParam);
}
......
......@@ -27,7 +27,7 @@ public class HttpUtilsTest {
assertEquals("Unknown", schemes.get(1).name);
assertEquals(1, schemes.get(1).params.size());
assertEquals("a", schemes.get(1).params.get("WithParam1"));
assertEquals("a", schemes.get(1).params.get("withparam1"));
assertEquals(1, schemes.get(1).params.size());
assertEquals(1, schemes.get(1).unnamedParams.size());
assertEquals("Param2", schemes.get(1).unnamedParams.get(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment