Skip to content

Commit 3499f1d

Browse files
dorshaclaude
andauthored
docs(xaa): document the read-only project-level audience on the XAA load response (#1677)
load_xaa_settings / load_all_xaa_settings return the audience a requesting application must present in its ID-JAG token. It is project-level and names no tenant - the IdP sends the tenant in the token's aud_tenant claim - so document it as part of the returned shape rather than leaving callers to build the value by hand. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent e864d47 commit 3499f1d

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

descope/management/sso_settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,10 @@ def load_xaa_settings(
584584
585585
Return value (dict):
586586
Containing the loaded XAA settings (ssoId, enabled, settings, groupsMapping, defaultSSORoles,
587-
fgaMappings, groupsPriority, groupPriorityEnabled, allowOverrideRoles).
587+
fgaMappings, groupsPriority, groupPriorityEnabled, allowOverrideRoles, audience).
588+
audience is read-only: the project-level audience a requesting application must present in its
589+
ID-JAG token. It carries no tenant segment - it equals the issuer the project publishes - so the
590+
identity provider must send the tenant id in the token's aud_tenant claim.
588591
589592
Raise:
590593
AuthException: raised if load operation fails

descope/management/sso_settings_async.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ async def load_xaa_settings(
316316
sso_id (str): Optional, the SSO configuration id (for multi-SSO). Omit for the default SSO configuration.
317317
318318
Return value (dict):
319-
Containing the loaded XAA settings.
319+
Containing the loaded XAA settings, including the read-only project-level audience a requesting
320+
application must present in its ID-JAG token. The audience carries no tenant segment - it equals
321+
the issuer the project publishes - so the identity provider must send the tenant id in the
322+
token's aud_tenant claim.
320323
321324
Raise:
322325
AuthException: raised if load operation fails

tests/management/test_sso_settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ async def test_load_xaa_settings(self, client_factory):
482482

483483
# Test success flow (with ssoId)
484484
resp_data = json.loads(
485-
"""{"ssoId": "sso-1", "enabled": true, "settings": {"issuers": {"https://issuer.example.com": {"jwksUri": "https://issuer.example.com/jwks", "signAlgorithm": "RS256"}}}, "groupsMapping": [{"role": {"id": "r1", "name": "role1"}, "groups": ["g1"]}], "defaultSSORoles": ["aa"], "groupPriorityEnabled": true, "allowOverrideRoles": true}"""
485+
"""{"ssoId": "sso-1", "enabled": true, "settings": {"issuers": {"https://issuer.example.com": {"jwksUri": "https://issuer.example.com/jwks", "signAlgorithm": "RS256"}}}, "groupsMapping": [{"role": {"id": "r1", "name": "role1"}, "groups": ["g1"]}], "defaultSSORoles": ["aa"], "groupPriorityEnabled": true, "allowOverrideRoles": true, "audience": "https://api.descope.com/v1/apps/P1"}"""
486486
)
487487
with client.mock_mgmt_get(make_response(resp_data)) as mock_get:
488488
resp = await client.invoke(client.mgmt.sso.load_xaa_settings("tenant-id", "sso-1"))
@@ -493,6 +493,8 @@ async def test_load_xaa_settings(self, client_factory):
493493
== "https://issuer.example.com/jwks"
494494
)
495495
assert resp.get("groupsMapping")[0]["role"]["name"] == "role1"
496+
# Read-only, project-level: no tenant segment - the tenant travels in the aud_tenant claim.
497+
assert resp.get("audience") == "https://api.descope.com/v1/apps/P1"
496498
assert_http_called(
497499
mock_get,
498500
client.mode,

0 commit comments

Comments
 (0)