-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1682 from Skyllarr/patch-1
[ELY-2315] Digest authentication fails for encoded paths
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,32 @@ public void testRfc2617EncodedQuery() throws Exception { | |
Assert.assertEquals(Status.COMPLETE, request2.getResult()); | ||
} | ||
|
||
@Test | ||
public void testRfc2617EncodedPath() throws Exception { | ||
mockDigestNonce("AAAAAQABsxiWa25/kpFxsPCrpDCFsjkTzs/Xr7RPsi/VVN6faYp21Hia3h4="); | ||
Map<String, Object> props = new HashMap<>(); | ||
props.put(CONFIG_REALM, "[email protected]"); | ||
props.put("org.wildfly.security.http.validate-digest-uri", "true"); | ||
HttpServerAuthenticationMechanism mechanism = digestFactory.createAuthenticationMechanism(DIGEST_NAME, props, getCallbackHandler("Mufasa", "[email protected]", "Circle Of Life")); | ||
|
||
String path = "/dir/foo%2Fr/index.html?foo=b%2Fr"; | ||
String uri = "http://localhost" + path; | ||
TestingHttpServerRequest request2 = new TestingHttpServerRequest(new String[] { | ||
"Digest username=\"Mufasa\",\n" + | ||
" realm=\"[email protected]\",\n" + | ||
" nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\",\n" + | ||
" uri=\"" + path + "\",\n" + | ||
" qop=auth,\n" + | ||
" nc=00000001,\n" + | ||
" cnonce=\"0a4f113b\",\n" + | ||
" response=\"cc3261565007973c9d647333822091ad\",\n" + | ||
" opaque=\"00000000000000000000000000000000\",\n" + | ||
" algorithm=MD5" | ||
}, new URI(uri)); | ||
mechanism.evaluateRequest(request2); | ||
Assert.assertEquals(Status.COMPLETE, request2.getResult()); | ||
} | ||
|
||
@Test | ||
public void testRfc7616sha256() throws Exception { | ||
mockDigestNonce("7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v"); | ||
|