Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for DPoP authorization failure. #781

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ abstract class BaseServlet: BaseHttpServlet() {
if (json["nonce"]?.jsonPrimitive?.content != dpopNonce) {
throw InvalidRequestException("Stale or invalid DPoP nonce")
}
if (json["htu"]?.jsonPrimitive?.content != req.requestURL.toString()) {
throw InvalidRequestException("Incorrect request URI: ${req.requestURL}")
val serverUrl = environment.getInterface(Configuration::class)!!.getValue("base_url")
// NB: cannot use req.requestURL, as it does not take into account potential frontends.
val expectedUrl = "$serverUrl${req.servletPath}"
val actualUrl = json["htu"]?.jsonPrimitive?.content
if (actualUrl != expectedUrl) {
throw InvalidRequestException("Incorrect request URI: $expectedUrl vs $actualUrl")
}
}
}