-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the URL query parameters from the HTU field
This fixes issue #1842. The HTU field is now build by addition rather than by substraction: the origin and path from the target URL are concatenated to build the DPoP header `htu` claim, rather than stripping elements from the target URL. Co-authored-by: Diego Albuquerque <[email protected]>
- Loading branch information
1 parent
4e705c5
commit 2dbc30b
Showing
3 changed files
with
21 additions
and
8 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 |
---|---|---|
|
@@ -66,6 +66,19 @@ describe("createDpopHeader", () => { | |
expect(payload.htu).toBe("https://some.resource/"); | ||
}); | ||
|
||
it("creates a JWT with 'htu' that needs to be normalized", async () => { | ||
const header = await createDpopHeader( | ||
"https://user:[email protected]/?query#hash", | ||
"GET", | ||
await mockKeyPair() | ||
); | ||
const { payload } = await jwtVerify(header, (await mockJwk()).publicKey); | ||
expect(payload.htm).toBe("GET"); | ||
expect(payload.jti).toBeDefined(); | ||
// The IRI is normalized, hence the trailing '/' | ||
expect(payload.htu).toBe("https://some.resource/"); | ||
}); | ||
|
||
it("creates a JWT with the appropriate protected header", async () => { | ||
const header = await createDpopHeader( | ||
"https://some.resource", | ||
|
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