Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ccd64b9
Add tests
mccoyp Sep 12, 2024
34fcfed
Implement CAE support
mccoyp Sep 12, 2024
d07e0a5
Share implementation across libraries
mccoyp Sep 13, 2024
84351af
Enable CAE; provide claims only in challenges
mccoyp Sep 18, 2024
c22cb08
Update tests for success scenarios
mccoyp Sep 19, 2024
d854071
Handle non-consecutive challenges (in Keys)
mccoyp Sep 19, 2024
6c19bbc
Cover invalid challenge flows
mccoyp Sep 20, 2024
c919056
Handle (in)valid challenge flows
mccoyp Sep 20, 2024
ff731e8
Share updates across libraries
mccoyp Sep 20, 2024
237c57b
Fix spelling, pylint
mccoyp Sep 20, 2024
013673b
Update changelogs
mccoyp Sep 26, 2024
5da13ff
Update tests for feedback
mccoyp Sep 26, 2024
36cb9fd
Use super() instead of private attribute
mccoyp Sep 26, 2024
f9ff176
Add live test; assert scope
mccoyp Sep 26, 2024
bf8f054
Fix auth policy to send scope correctly
mccoyp Sep 26, 2024
850e6e8
Async tests; sync challenge policy code
mccoyp Sep 26, 2024
e78d4e9
Ensure no re-sending claims in tests
mccoyp Oct 3, 2024
1a6c9f7
Fix policy to handle KV -> KV challenge
mccoyp Oct 3, 2024
3fad4db
Share bug fix across libraries
mccoyp Oct 3, 2024
ba2a954
Clarify test variable names
mccoyp Oct 4, 2024
92c6704
Correctly handle token refreshes
mccoyp Oct 5, 2024
8e65726
Bump Core dep for SupportsTokenInfo protocol support
mccoyp Oct 8, 2024
93c7eaa
(Async)SupportsTokenInfo support/tests
mccoyp Oct 8, 2024
bf25378
Pylint
mccoyp Oct 8, 2024
3cb6481
Mention Core bump, enable_cae kwarg in changelogs
mccoyp Oct 16, 2024
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
Prev Previous commit
Next Next commit
Fix auth policy to send scope correctly
  • Loading branch information
mccoyp committed Oct 7, 2024
commit bf8f054819c5bceef6cd1b91dc886189be4c498a
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def on_challenge(self, request: PipelineRequest, response: PipelineResponse) ->
old_tenant = cached_challenge.tenant_id

challenge = _update_challenge(request, response)
# CAE challenges may not include a scope or tenant; use the previous challenge's values if necessary
if challenge.claims and old_scope:
challenge._parameters["scope"] = old_scope # pylint:disable=protected-access
challenge.tenant_id = old_tenant
# azure-identity credentials require an AADv2 scope but the challenge may specify an AADv1 resource
scope = challenge.get_scope() or challenge.get_resource() + "/.default"
except ValueError:
Expand All @@ -191,13 +195,7 @@ def on_challenge(self, request: PipelineRequest, response: PipelineResponse) ->
if self._verify_challenge_resource:
resource_domain = urlparse(scope).netloc
if not resource_domain:
# Use the old scope for CAE challenges. The parsing will succeed here since it did before
if challenge.claims and old_scope:
resource_domain = urlparse(old_scope).netloc
challenge._parameters["scope"] = old_scope # pylint:disable=protected-access
challenge.tenant_id = old_tenant
else:
raise ValueError(f"The challenge contains invalid scope '{scope}'.")
raise ValueError(f"The challenge contains invalid scope '{scope}'.")

request_domain = urlparse(request.http_request.url).netloc
if not request_domain.lower().endswith(f".{resource_domain.lower()}"):
Expand Down