fix: normalize trailing slashes before length check in check_resource_allowed (#2074)
This commit is contained in:
parent
705497a593
commit
be5bb7c4f2
1 changed files with 5 additions and 16 deletions
|
|
@ -493,12 +493,6 @@ class OAuthClientProvider(httpx.Auth):
|
|||
if not prm_resource:
|
||||
return # pragma: no cover
|
||||
default_resource = resource_url_from_server_url(self.context.server_url)
|
||||
# Normalize: Pydantic AnyHttpUrl adds trailing slash to root URLs
|
||||
# (e.g. "https://example.com/") while resource_url_from_server_url may not.
|
||||
if not default_resource.endswith("/"):
|
||||
default_resource += "/"
|
||||
if not prm_resource.endswith("/"):
|
||||
prm_resource += "/"
|
||||
if not check_resource_allowed(requested_resource=default_resource, configured_resource=prm_resource):
|
||||
raise OAuthFlowError(f"Protected resource {prm_resource} does not match expected {default_resource}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue