Skip to content

Commit

Permalink
Merge pull request #421 from Mrfence97/main
Browse files Browse the repository at this point in the history
fix: Regex extracting claims (addressing #420)
  • Loading branch information
andrueastman authored Dec 5, 2024
2 parents 2f71b38 + 9d6ea39 commit b48a9fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/http/httpx/kiota_http/httpx_request_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ async def retry_cae_response_if_required(
if auth_header_value.casefold().startswith(
self.BEARER_AUTHENTICATION_SCHEME.casefold()
):
claims_match = re.search('claims="(.+)"', auth_header_value)
claims_match = re.search('claims="([^"]+)"', auth_header_value)
if not claims_match:
raise ValueError("Unable to parse claims from response")
response_claims = claims_match.group().split('="')[1]
response_claims = claims_match.group(1)
parent_span.add_event(AUTHENTICATE_CHALLENGED_EVENT_KEY)
parent_span.set_attribute("http.retry_count", 1)
return await self.get_http_response_message(
Expand Down
2 changes: 1 addition & 1 deletion packages/http/httpx/tests/test_httpx_request_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ async def test_retries_on_cae_failure(
{
"claims": (
"eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbH"
"VlIjoiMTYwNDEwNjY1MSJ9fX0"
"VlIjoiMTYwNDEwNjY1MSJ9fX0="
)
},
),
Expand Down

0 comments on commit b48a9fb

Please sign in to comment.