From 45f0ed2299a94fdf0163ff8bb0b23e115f88c1b5 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 17 Nov 2026 22:43:34 +0100 Subject: [PATCH 1/4] fix: read entitlements from eduperson_entitlement The node read entitlements only from the user info claim `entitlements`, as the operator's docs say. LS Login released them to other clients of the same issuer in `eduperson_entitlement` (generic-issues#46). The node would then refuse account A with `refused: entitlement`, which looks exactly like a missing group release in T3. The node now reads every claim in `TESTBED_ENTITLEMENT_CLAIMS` (default `entitlements,eduperson_entitlement`) and takes the union of their values. Its report names the claims it found (`entitlement_claims` in the session's rows), and `discovery` shows `scopes_supported` and `claims_supported`. Co-Authored-By: Claude Opus 5.5 --- src/testbed/service.py | 27 ++++++++---- src/testbed/session.py | 3 ++ src/testbed/settings.py | 30 +++++++++++++ tests/test_services.py | 94 +++++++++++++++++++++++++++++++++++++++++ tests/test_session.py | 13 ++++++ tests/test_settings.py | 26 ++++++++++++ 6 files changed, 185 insertions(+), 8 deletions(-) diff --git a/src/testbed/service.py b/src/testbed/service.py index 513b1e5..da954fc 100644 --- a/src/testbed/service.py +++ b/src/testbed/service.py @@ -110,12 +110,16 @@ def __init__( def _entitlements(self, token: str, claims: dict[str, Any]) -> dict[str, Any]: """Get the user's entitlements from user info, as computed for this token. + The values are the union of all configured claims, in order of + appearance, as providers differ in the claim they release them in. + Args: token: Validated access token. claims: Verified claims of the token. Returns: - Entitlements, or the reason why there are none to show. + Entitlements and the names of the claims they were read from, or + the reason why there are none to show. """ try: userinfo = self.tokens.userinfo(token) @@ -126,13 +130,20 @@ def _entitlements(self, token: str, claims: dict[str, Any]) -> dict[str, Any]: return {"values": [], "error": "user info request failed"} if userinfo.get("sub") != claims.get("sub"): return {"values": [], "error": "user info is about another subject"} - found = userinfo.get("entitlements", []) - found = [found] if isinstance(found, str) else found - if not isinstance(found, list) or not all( - isinstance(item, str) for item in found - ): - return {"values": [], "error": "entitlements is not a list of strings"} - return {"values": found} + values: dict[str, None] = {} + sources = [] + for name in self.settings.entitlement_claims: + if name not in userinfo: + continue + found = userinfo[name] + found = [found] if isinstance(found, str) else found + if not isinstance(found, list) or not all( + isinstance(item, str) for item in found + ): + return {"values": [], "error": f"{name} is not a list of strings"} + sources.append(name) + values.update(dict.fromkeys(found)) + return {"values": list(values), "claims": sources} def check(self, headers: Any) -> RequestContext: """Check an incoming request. diff --git a/src/testbed/session.py b/src/testbed/session.py index 9b14973..b74924b 100644 --- a/src/testbed/session.py +++ b/src/testbed/session.py @@ -129,6 +129,7 @@ def hop_rows(report: dict[str, Any]) -> list[dict[str, Any]]: "scope": claims.get("scope"), "lifetime": current.get("lifetime", {}).get("exp_minus_iat"), "entitlements": current.get("entitlements", {}).get("values"), + "entitlement_claims": current.get("entitlements", {}).get("claims"), "entitlements_error": current.get("entitlements", {}).get("error"), "policy": current.get("policy"), "hop_limit": current.get("hop_limit"), @@ -670,6 +671,8 @@ def _discovery(self) -> dict[str, Any]: "device_authorization_endpoint", "introspection_endpoint", "revocation_endpoint", + "scopes_supported", + "claims_supported", ) return {"ok": True, **{key: document.get(key) for key in fields}} diff --git a/src/testbed/settings.py b/src/testbed/settings.py index d618fc9..fee9f4f 100644 --- a/src/testbed/settings.py +++ b/src/testbed/settings.py @@ -26,6 +26,9 @@ SERVICE_PORTS = {"gateway": 18991, "node": 18992, "orchestrator": 18993, "loop": 18995} NEXT_HOP = {"orchestrator": "gateway", "gateway": "node", "loop": "loop"} TARGET_PARAMS = ("audience", "resource", "resource-url", "both") +# The claim of AARC-G069 and the operator's Entitlements page, and the one that +# LS Login released to other clients of the same issuer +ENTITLEMENT_CLAIMS = ("entitlements", "eduperson_entitlement") @dataclass(frozen=True) @@ -60,6 +63,8 @@ class Settings: algorithms: Accepted signature algorithms. token_types: Accepted values of the `typ` header. required_entitlement: Entitlement that the node requires, if any. + entitlement_claims: Claims of user info that hold entitlements; the + node takes the union of their values. target_param: Which parameters services name their next hop with in exchanges: `audience`, `resource`, `resource-url` or `both`. exchange_scope: `scope` that services request in exchanges, if any. @@ -75,6 +80,7 @@ class Settings: algorithms: tuple[str, ...] = ("RS256",) token_types: tuple[str, ...] = ("at+jwt", "application/at+jwt") required_entitlement: str | None = None + entitlement_claims: tuple[str, ...] = ENTITLEMENT_CLAIMS target_param: str = "audience" exchange_scope: str | None = None callback_bind: str = "localhost" @@ -146,6 +152,7 @@ def _mock_settings(env: Mapping[str, str]) -> Settings: required_entitlement=( env.get("TESTBED_REQUIRED_ENTITLEMENT", MOCK_ENTITLEMENT) or None ), + entitlement_claims=_entitlement_claims(env), target_param=_target_param(env), exchange_scope=env.get("TESTBED_EXCHANGE_SCOPE") or None, callback_bind=env.get("TESTBED_CALLBACK_BIND") or "localhost", @@ -170,6 +177,28 @@ def _target_param(env: Mapping[str, str]) -> str: return value +def _entitlement_claims(env: Mapping[str, str]) -> tuple[str, ...]: + """Get the claims of user info that hold entitlements. + + Args: + env: Environment variables. + + Returns: + Claim names, without repeats, in the order given; both known names if + the variable is unset or empty. + + Raises: + ValueError: The value holds no claim name. + """ + value = env.get("TESTBED_ENTITLEMENT_CLAIMS") + if not value: + return ENTITLEMENT_CLAIMS + names = tuple(dict.fromkeys(n.strip() for n in value.split(",") if n.strip())) + if not names: + raise ValueError("TESTBED_ENTITLEMENT_CLAIMS names no claim") + return names + + def _ls_login_settings(env: Mapping[str, str]) -> Settings: """Create settings for LS Login, from the environment. @@ -216,6 +245,7 @@ def _ls_login_settings(env: Mapping[str, str]) -> Settings: clients=clients, algorithms=tuple(env.get("TESTBED_ALGORITHMS", "RS256").split(",")), required_entitlement=env.get("TESTBED_REQUIRED_ENTITLEMENT") or None, + entitlement_claims=_entitlement_claims(env), target_param=target_param, exchange_scope=env.get("TESTBED_EXCHANGE_SCOPE") or None, callback_bind=env.get("TESTBED_CALLBACK_BIND") or "localhost", diff --git a/tests/test_services.py b/tests/test_services.py index 7c8b1c6..42b1b9a 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -420,3 +420,97 @@ def test_tokens_without_times_have_no_lifetime() -> None: """A lifetime is only stated if the claims allow it.""" assert _lifetime({"exp": 10, "iat": 4}) == {"exp_minus_iat": 6} assert _lifetime({"exp": 10}) == {"exp_minus_iat": None} + + +@pytest.mark.parametrize( + ("userinfo", "values", "claims"), + [ + ( + {"eduperson_entitlement": [ENTITLEMENT]}, + [ENTITLEMENT], + ["eduperson_entitlement"], + ), + ({"entitlements": [ENTITLEMENT]}, [ENTITLEMENT], ["entitlements"]), + ( + { + "entitlements": [ENTITLEMENT, "urn:a"], + "eduperson_entitlement": ["urn:a", ENTITLEMENT, "urn:b"], + }, + [ENTITLEMENT, "urn:a", "urn:b"], + ["entitlements", "eduperson_entitlement"], + ), + ( + {"eduperson_entitlement": ENTITLEMENT}, + [ENTITLEMENT], + ["eduperson_entitlement"], + ), + ], + ids=["eduperson only", "entitlements only", "both", "single string"], +) +def test_entitlements_come_from_either_claim( + node: FlaskClient, + provider: FakeProvider, + userinfo: dict[str, Any], + values: list[str], + claims: list[str], +) -> None: + """LS Login may release `eduperson_entitlement` rather than `entitlements`. + + Args: + node: Test client of the node. + provider: Fake provider. + userinfo: User info, apart from `sub`. + values: Expected entitlements, as a union in order of appearance. + claims: Expected names of the claims that held them. + """ + base = provider.issuer.rstrip("/") + provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( + 200, {"sub": "user-1", **userinfo} + ) + response = node.get("/report", headers=_bearer(provider.mint())) + assert response.status_code == 200 + body = response.get_json() + assert body["policy"] == "allowed" + assert body["entitlements"] == {"values": values, "claims": claims} + + +def test_no_entitlement_claim_is_403_and_names_no_claim( + node: FlaskClient, provider: FakeProvider +) -> None: + """Without either claim, the user lacks the group: 403, no claim named.""" + base = provider.issuer.rstrip("/") + provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( + 200, {"sub": "user-1"} + ) + response = node.get("/report", headers=_bearer(provider.mint())) + assert response.status_code == 403 + assert response.get_json()["entitlements"] == {"values": [], "claims": []} + + +def test_a_wrong_type_in_one_claim_names_that_claim( + node: FlaskClient, provider: FakeProvider +) -> None: + """An odd value in one claim is an error, even if the other one is fine.""" + base = provider.issuer.rstrip("/") + provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( + 200, + {"sub": "user-1", "entitlements": [ENTITLEMENT], "eduperson_entitlement": 1}, + ) + response = node.get("/report", headers=_bearer(provider.mint())) + assert response.status_code == 502 + error = response.get_json()["entitlements"]["error"] + assert error == "eduperson_entitlement is not a list of strings" + + +def test_entitlement_claims_can_be_configured(provider: FakeProvider) -> None: + """Only the configured claims count.""" + env = {**LS_ENV, "TESTBED_ENTITLEMENT_CLAIMS": "groups"} + client = create_node(load_settings(env, "lslogin"), provider).test_client() + base = provider.issuer.rstrip("/") + provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( + 200, + {"sub": "user-1", "groups": [ENTITLEMENT], "eduperson_entitlement": 1}, + ) + response = client.get("/report", headers=_bearer(provider.mint())) + assert response.status_code == 200 + assert response.get_json()["entitlements"]["claims"] == ["groups"] diff --git a/tests/test_session.py b/tests/test_session.py index 6996091..bf9871a 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -660,6 +660,19 @@ def test_provider_problems_are_named(session: Session, provider: FakeProvider) - assert "Discovery failed" in session.execute("discovery")["provider_problem"] +def test_discovery_shows_scopes_and_claims( + session: Session, provider: FakeProvider +) -> None: + """T1 records which entitlement scope and claim the provider advertises.""" + provider.discovery_overrides = { + "scopes_supported": ["openid", "eduperson_entitlement"], + "claims_supported": ["sub", "eduperson_entitlement"], + } + result = session.execute("discovery") + assert result["scopes_supported"] == ["openid", "eduperson_entitlement"] + assert result["claims_supported"] == ["sub", "eduperson_entitlement"] + + def test_parser_never_exits() -> None: """Argparse's way out would end the session and lose its tokens.""" with pytest.raises(UsageError, match="the problem"): diff --git a/tests/test_settings.py b/tests/test_settings.py index 54688bc..07fc32e 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -82,3 +82,29 @@ def test_resource_url_needs_the_urls_of_the_next_hops() -> None: env["TESTBED_NODE_RESOURCE"] = "https://node.example/" env["TESTBED_GATEWAY_RESOURCE"] = "https://gateway.example/" assert load_settings(env, "lslogin").target_param == "resource-url" + + +@pytest.mark.parametrize( + ("provider", "env"), [("mock", {}), ("lslogin", LS_ENV)], ids=["mock", "lslogin"] +) +def test_entitlement_claims_default_to_both_names( + provider: str, env: dict[str, str] +) -> None: + """Both the AARC-G069 name and the one LS Login was seen to release. + + Args: + provider: Provider. + env: Environment variables. + """ + claims = load_settings(env, provider).entitlement_claims + assert claims == ("entitlements", "eduperson_entitlement") + empty = load_settings({**env, "TESTBED_ENTITLEMENT_CLAIMS": ""}, provider) + assert empty.entitlement_claims == claims + + +def test_entitlement_claims_are_a_comma_separated_list() -> None: + """Spaces, empty items and repeats are ignored; nothing left is an error.""" + env = {**LS_ENV, "TESTBED_ENTITLEMENT_CLAIMS": " a , ,b,a "} + assert load_settings(env, "lslogin").entitlement_claims == ("a", "b") + with pytest.raises(ValueError, match="TESTBED_ENTITLEMENT_CLAIMS"): + load_settings({**LS_ENV, "TESTBED_ENTITLEMENT_CLAIMS": " , "}, "lslogin") From ec3f40d10a1632e856c24241b5ca7ead8576d499 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 17 Nov 2026 22:45:00 +0100 Subject: [PATCH 2/4] docs: describe both entitlement claims Document `TESTBED_ENTITLEMENT_CLAIMS` (configuration, template), what generic-issues#46 observed, and what T1 and T3 record: the entitlement scopes and claims the provider lists, the claim and scope the values came with, and a one-off login with the scope `eduperson_entitlement` if user info shows neither claim. Co-Authored-By: Claude Opus 5.5 --- docs/setup/client-registration.md | 2 +- docs/setup/configuration.md | 1 + docs/setup/troubleshooting.md | 2 +- docs/testbed/assumptions.md | 4 +++- docs/testbed/design.md | 2 +- docs/tests/t1-call-chain.md | 4 ++-- docs/tests/t3-groups.md | 11 +++++++++-- lslogin.env.example | 4 ++++ 8 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/setup/client-registration.md b/docs/setup/client-registration.md index dde3ddf..5be165c 100644 --- a/docs/setup/client-registration.md +++ b/docs/setup/client-registration.md @@ -80,7 +80,7 @@ The VO admins perform group assignments to the resource. The client maintainer c 1. Create a resource for the relevant VO on the facility representing the client. 2. Send the VO admins links to the resource and the groups to assign. Ask them to complete the assignment and confirm it. Verify that the groups appear among the resource's assigned groups. -3. Log in with a test account belonging to the assigned group, and use the session's `userinfo ` command to inspect the released entitlements. Compare the exact value with `TESTBED_REQUIRED_ENTITLEMENT` in `lslogin.env`; do not assume the example value matches. +3. Log in with a test account belonging to the assigned group, and use the session's `userinfo ` command to inspect the released entitlements. Compare the exact value with `TESTBED_REQUIRED_ENTITLEMENT` in `lslogin.env`; do not assume the example value matches. Note the claim it came in, too: `entitlements` or `eduperson_entitlement` ([What we've seen](../testbed/assumptions.md#what-weve-seen)). 4. Repeat the release setup for each service that needs it. For this testbed, follow the facility list above, preserving the deliberate omission for the orchestrator in T3. 5. Use T3 to verify that a user outside the required group can still log in but receives 403 from the node. diff --git a/docs/setup/configuration.md b/docs/setup/configuration.md index 7e3ae11..3f3438c 100644 --- a/docs/setup/configuration.md +++ b/docs/setup/configuration.md @@ -28,6 +28,7 @@ All settings are environment variables. | `TESTBED_GATEWAY_RESOURCE` | The same for the gateway | | | `TESTBED_ORCHESTRATOR_RESOURCE` | The same for the orchestrator | | | `TESTBED_REQUIRED_ENTITLEMENT` | The value that the node's policy requires, from any entitlement or capability; empty for no policy. `ECP_CLN` in the template is an example | On the mock: a made-up one | +| `TESTBED_ENTITLEMENT_CLAIMS` | Claims of user info that the node reads entitlements from, comma-separated. It takes the union of their values, and its row names the claims that were there (`entitlement_claims`). LS Login's docs name `entitlements`; other clients of the same issuer got `eduperson_entitlement` ([What we've seen](../testbed/assumptions.md#what-weve-seen)) | `entitlements,eduperson_entitlement` | | `TESTBED_TARGET_PARAM` | How services name their next hop in exchanges: see below | `audience` | | `TESTBED_EXCHANGE_SCOPE` | `scope` that services request in exchanges; empty for none | | | `TESTBED_ISSUER` | Issuer, exactly as in tokens. For trying another stack, e.g., `https://login.aai.lifescience-ri.eu/cas/oidc` (never tried) | `https://login.aai.lifescience-ri.eu/oidc/` | diff --git a/docs/setup/troubleshooting.md b/docs/setup/troubleshooting.md index 53fcb15..a422ab4 100644 --- a/docs/setup/troubleshooting.md +++ b/docs/setup/troubleshooting.md @@ -32,7 +32,7 @@ **A node answers 502 with `refused: userinfo`.** The node couldn't find out the entitlements: `entitlements_error` in its row says why. This isn't a decision about the user. Perhaps the exchanged token lacks a scope for user info: see `TESTBED_EXCHANGE_SCOPE`. -**A node answers 403 for a member of the group.** The release is probably missing on the exchanging client ([C4](../testbed/assumptions.md#constraints)). +**A node answers 403 for a member of the group.** The release is probably missing on the exchanging client ([C4](../testbed/assumptions.md#constraints)). Check `entitlement_claims` in the node's row, too: if it's empty, user info held none of the claims in `TESTBED_ENTITLEMENT_CLAIMS`. Compare with what `userinfo` shows, and add the claim that holds them. **A service answers 502 with `refused: exchange`.** LS Login refused the next hop's exchange, or couldn't be reached. The row says which. diff --git a/docs/testbed/assumptions.md b/docs/testbed/assumptions.md index a394e70..21689ed 100644 --- a/docs/testbed/assumptions.md +++ b/docs/testbed/assumptions.md @@ -52,7 +52,7 @@ Our own assumptions, from no statement at all: These pages describe Perun and its proxy. They cover several Perun instances, so they may not describe LS Login exactly. -- [Entitlements](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/209813518/Entitlements): in OIDC, request the `entitlements` scope to receive the values in the `entitlements` claim at the UserInfo endpoint, as specified by [AARC-G069](https://aarc-community.org/guidelines/aarc-g069/). The testbed uses only this scope and claim name. A group entitlement is released for each group the user is in, if that group is assigned to a resource on the facility of the service. +- [Entitlements](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/209813518/Entitlements): in OIDC, request the `entitlements` scope to receive the values in the `entitlements` claim at the UserInfo endpoint, as specified by [AARC-G069](https://aarc-community.org/guidelines/aarc-g069/). Other clients of the same issuer got another claim, though: see [What we've seen](#what-weve-seen). The testbed's login asks for the scope `entitlements`, and the node reads both claims (`TESTBED_ENTITLEMENT_CLAIMS` in [Configuration](../setup/configuration.md#settings)). A group entitlement is released for each group the user is in, if that group is assigned to a resource on the facility of the service. - [Group entitlement](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/350879786/Group+entitlement): the value depends on group names, in the form `:group:[:*][#]`, so it changes if a group is renamed or moved. - [Resource capability](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/351272963/Resource+capability): the alternative that doesn't depend on group names. The Entitlements page recommends it for that reason. - [Facility](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/2252570626/Facility) and [Resource](https://perunaai.atlassian.net/wiki/spaces/PERUN/pages/2261055/Resource): the entities behind A9. @@ -80,4 +80,6 @@ The `/oidc/` document again, on 2026-11-13, for [delegated access](delegated-acc - **Listed:** the scope `offline_access`; the grants `refresh_token` and token exchange; a revocation endpoint, `https://login.aai.lifescience-ri.eu/oidc/revoke`; an introspection endpoint; the token endpoint authentication methods `client_secret_basic`, `client_secret_post` and `none`. - **Not listed:** `prompt_values_supported`, `dpop_signing_alg_values_supported`, `tls_client_certificate_bound_access_tokens` and `backchannel_logout_supported`. A missing field doesn't prove that a feature is missing, but no standard way of binding tokens to a client instance is advertised ([C11](#constraints)). +Entitlements as LS Login released them to other clients of the `/oidc/` issuer (read on 2026-11-12 and 2026-11-15, recorded in [generic-issues#46](https://github.com/elixir-cloud-aai/generic-issues/issues/46)): in the claim **`eduperson_entitlement`**, not `entitlements`, and in user info only. The access token carried the scope `eduperson_entitlement`, but not the values. Which claim the testbed's clients get with the scope `entitlements` is unknown until [T1](../tests/t1-call-chain.md) and [T3](../tests/t3-groups.md) have run, so the node reads both. + A login token of Krini's, seen by us on 2026-10-20: `typ` was `at+jwt`, and `aud` held the client's ID. diff --git a/docs/testbed/design.md b/docs/testbed/design.md index 92be138..22ce620 100644 --- a/docs/testbed/design.md +++ b/docs/testbed/design.md @@ -36,7 +36,7 @@ With the orchestrator in the chain, the client exchanges for the orchestrator, a ## What the services do - **Validation:** as in FOCA's `foca.security.auth._validate()` with its defaults (checked against FOCA 0.19.0): trusted issuer, `typ` is `at+jwt`, discovery, signature (RS256), `exp`, `iat`, `iss`, `sub`, `aud`, no leeway. Unlike FOCA, it tells the caller the reason. -- **Node:** validates, reads entitlements from user info, applies its own policy (403 without the group, 502 if user info gives no answer), reports what it saw. +- **Node:** validates, reads entitlements from user info (both `entitlements` and `eduperson_entitlement` by default), applies its own policy (403 without the group, 502 if user info gives no answer), reports what it saw. - **Gateway:** validates, exchanges the token for the next hop, forwards, reports all hops. With another role, the same code is the orchestrator. Authorisation at the gateway only covers who may use the gateway. - **`Hop-Limit` header:** further forwards allowed, by default 8; at 0 a forwarding service answers 508. It's custom, as `Max-Forwards` only applies to TRACE and OPTIONS. - **`traceparent`:** valid [W3C Trace Context](https://www.w3.org/TR/trace-context/) values pass through unchanged, others are replaced. diff --git a/docs/tests/t1-call-chain.md b/docs/tests/t1-call-chain.md index bfd9774..5bcdf5b 100644 --- a/docs/tests/t1-call-chain.md +++ b/docs/tests/t1-call-chain.md @@ -26,7 +26,7 @@ tb> clients tb> discovery ``` -Provider `lslogin`, `ls_login_rules_emulated: false`, all five clients, and token exchange among the grant types. No testbed rule applies from here on: refusals are LS Login's own, with `refused_by: provider`. +Provider `lslogin`, `ls_login_rules_emulated: false`, all five clients, and token exchange among the grant types. Note which of `entitlements` and `eduperson_entitlement` are in `scopes_supported` and `claims_supported`: the node reads both claims ([T3](t3-groups.md)). No testbed rule applies from here on: refusals are LS Login's own, with `refused_by: provider`. ### Login: user to client @@ -124,7 +124,7 @@ Discovery at `/oidc/` lists the auth method `none`, and at `/cas/oidc` doesn't ( | Step | Record | Result | |---|---|---| -| Provider and clients | Provider, grant types | | +| Provider and clients | Provider, grant types, and which entitlement scopes and claims are listed | | | Login | `sub`, `typ`, `aud`, `client_id`, `exp` minus `iat`, whether there's a refresh token, what the consent page lists, and whether it mentions offline access | | | Hop 1 | Which parameter works, `aud`, `client_id`, `azp`, `exp` minus `iat`, `scope`, `typ` | | | URL form | `aud`, the status of the call | | diff --git a/docs/tests/t3-groups.md b/docs/tests/t3-groups.md index 83b0d63..d598184 100644 --- a/docs/tests/t3-groups.md +++ b/docs/tests/t3-groups.md @@ -33,6 +33,13 @@ tb> exchange to-node-s --as gateway --from to-gw --audience @node --scope "openi tb> userinfo to-node-s ``` +The node reads entitlements from `entitlements` and `eduperson_entitlement` (`TESTBED_ENTITLEMENT_CLAIMS`), and its row names the claims it found them in (`entitlement_claims`). Note which of the two `userinfo user` shows. If it shows neither, try the other scope once, and note whether the registration allows it: + +```text +tb> login u2 --as client --scope "openid eduperson_entitlement offline_access" +tb> userinfo u2 +``` + ### Account A through the chain ```text @@ -100,7 +107,7 @@ We derived the example from a known entitlement of the same form ([A12](../testb | Step | Record | Result | |---|---|---| | Release per client | The entitlements for each line. Does `introspect --as node` differ? Does the exchange need the `scope`? | | -| Exact value | The entitlement in user info, compared with `TESTBED_REQUIRED_ENTITLEMENT` | | -| Account A | Status, `policy` at the node | | +| Exact value | The entitlement in user info, compared with `TESTBED_REQUIRED_ENTITLEMENT`; the claim it came in (`entitlements` or `eduperson_entitlement`) and the scope it took | | +| Account A | Status, `policy` and `entitlement_claims` at the node | | | Account B | Login, exchange, status and `refused` at the node | | | Group release | Which role it took, and who granted it | TrustedFacilityAdmin within the relevant VO; not granted for this setup, so the VO admins assign groups on request ([Client registration](../setup/client-registration.md#who-can-assign-groups)) | diff --git a/lslogin.env.example b/lslogin.env.example index 1a35592..b060fc3 100644 --- a/lslogin.env.example +++ b/lslogin.env.example @@ -31,6 +31,10 @@ TESTBED_ORCHESTRATOR_RESOURCE=https://tx-test-orchestrator.elixir-on.cloud/ # The node's policy; an example, to be compared with what `userinfo` shows TESTBED_REQUIRED_ENTITLEMENT="urn:geant:lifescience-ri.eu:group:elixir:ECP_CLN#aai.lifescience-ri.eu" +# Claims of user info that hold entitlements, comma-separated; the node takes +# the union. LS Login's docs name `entitlements`, but other clients of the +# same issuer got `eduperson_entitlement` +TESTBED_ENTITLEMENT_CLAIMS=entitlements,eduperson_entitlement # How services name their next hop in exchanges: audience, resource, # resource-url or both From 50bfaa91d122969b99fb3275c860879e7c9c8814 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 17 Nov 2026 23:12:07 +0100 Subject: [PATCH 3/4] fix: skip entitlement claims of the wrong type A claim of another type made the whole result an error, so a user whose entitlement was in the other claim got 502. Now such a claim is skipped and named in `error`, `null` counts as absent, and `claims` is in every result. Document the behaviour, the trust in both claims, and the claim fields of `discovery` and `call` (review findings). Co-Authored-By: Claude Opus 5.5 --- docs/about/commands.md | 6 ++-- docs/setup/client-registration.md | 2 ++ docs/setup/configuration.md | 2 +- docs/setup/troubleshooting.md | 2 +- docs/testbed/assumptions.md | 2 +- docs/tests/t3-groups.md | 4 +-- src/testbed/service.py | 32 +++++++++++++------- tests/test_services.py | 49 +++++++++++++++++++++++++++---- tests/test_session.py | 9 ++++++ 9 files changed, 85 insertions(+), 23 deletions(-) diff --git a/docs/about/commands.md b/docs/about/commands.md index e5dcd54..da14f11 100644 --- a/docs/about/commands.md +++ b/docs/about/commands.md @@ -48,15 +48,15 @@ Tokens are kept under names you choose. Targets in `--audience` and `--resource` | Command | Does | Options | |---|---|---| | `clients` | Shows the configured clients, never their secrets | | -| `discovery` | Shows what the provider's discovery document says | | +| `discovery` | Shows what the provider's discovery document says, including `scopes_supported` and `claims_supported` | | | `lifetimes` | Shows the lifetimes of all tokens of this session | | | `login ` | Logs in a user via the dummy client | `--as `, `--flow code\|device`, `--scope`, `--resource`, `--no-browser`, `--mock-user inside\|outside`, `--mock-issuer short\|rogue` | | `exchange ` | Exchanges a token; `--as` is the exchanging client | `--as `, `--from `, `--audience`, `--resource`, `--scope`, `--requested-type access\|refresh`, `--auth auto\|basic\|post\|none`, `--tamper-subject`, `--no-rules` | | `refresh ` | Redeems the refresh token held by a token of the session | `--as `, `--from `, `--audience`, `--resource`, `--scope` | | `credentials ` | Gets a client's own token | `--as `, `--scope` | -| `call ` | Calls a service with a token and shows what each hop saw | `--token `, `--save `, `--hop-limit`, `--traceparent`, `--tamper`, `--id-token`, `--full` | +| `call ` | Calls a service with a token and shows what each hop saw, including the node's `entitlements` and the claims they came from (`entitlement_claims`) | `--token `, `--save `, `--hop-limit`, `--traceparent`, `--tamper`, `--id-token`, `--full` | | `show ` | Shows the decoded claims of a token | | -| `userinfo ` | Calls user info with a token; shows released entitlements | | +| `userinfo ` | Calls user info with a token; shows released entitlements, in whichever claim they come | | | `introspect ` | Introspects a token as a client | `--as `, `--refresh` | | `revoke ` | Revokes a token as a client | `--as `, `--refresh` | | `wait-expiry ` | Blocks until a token has expired; Ctrl-C ends the wait | `--margin ` | diff --git a/docs/setup/client-registration.md b/docs/setup/client-registration.md index 5be165c..992c7ea 100644 --- a/docs/setup/client-registration.md +++ b/docs/setup/client-registration.md @@ -24,6 +24,8 @@ Register them at the [service registration app](https://services.aai.lifescience | `tx-test-client` | Krini with a backend | confidential | authorization code with PKCE, refresh token, token exchange, device code | `openid`, `entitlements`, `offline_access` | | `tx-test-public` | Krini without a backend | public, PKCE | as `tx-test-client` | as `tx-test-client` | +Other clients of the same issuer got entitlements with the scope and claim `eduperson_entitlement` ([What we've seen](../testbed/assumptions.md#what-weve-seen)). If [T3](../tests/t3-groups.md) shows none with `entitlements`, ask for `eduperson_entitlement` on each client, too. + Redirect URI of the last two: `http://localhost:18994/callback`. The others have none. Resource indicators: diff --git a/docs/setup/configuration.md b/docs/setup/configuration.md index 3f3438c..2b37d71 100644 --- a/docs/setup/configuration.md +++ b/docs/setup/configuration.md @@ -28,7 +28,7 @@ All settings are environment variables. | `TESTBED_GATEWAY_RESOURCE` | The same for the gateway | | | `TESTBED_ORCHESTRATOR_RESOURCE` | The same for the orchestrator | | | `TESTBED_REQUIRED_ENTITLEMENT` | The value that the node's policy requires, from any entitlement or capability; empty for no policy. `ECP_CLN` in the template is an example | On the mock: a made-up one | -| `TESTBED_ENTITLEMENT_CLAIMS` | Claims of user info that the node reads entitlements from, comma-separated. It takes the union of their values, and its row names the claims that were there (`entitlement_claims`). LS Login's docs name `entitlements`; other clients of the same issuer got `eduperson_entitlement` ([What we've seen](../testbed/assumptions.md#what-weve-seen)) | `entitlements,eduperson_entitlement` | +| `TESTBED_ENTITLEMENT_CLAIMS` | Claims of user info that the node reads entitlements from, comma-separated. It takes the union of their values, and its row names the claims that were there (`entitlement_claims`). A claim of another type is skipped and named in `entitlements_error`: then only the other claims can allow the user, and without the entitlement in them, the node answers 502. Applies to the mock, too, which releases `entitlements`. LS Login's docs name `entitlements`; other clients of the same issuer got `eduperson_entitlement` ([What we've seen](../testbed/assumptions.md#what-weve-seen)) | `entitlements,eduperson_entitlement` | | `TESTBED_TARGET_PARAM` | How services name their next hop in exchanges: see below | `audience` | | `TESTBED_EXCHANGE_SCOPE` | `scope` that services request in exchanges; empty for none | | | `TESTBED_ISSUER` | Issuer, exactly as in tokens. For trying another stack, e.g., `https://login.aai.lifescience-ri.eu/cas/oidc` (never tried) | `https://login.aai.lifescience-ri.eu/oidc/` | diff --git a/docs/setup/troubleshooting.md b/docs/setup/troubleshooting.md index a422ab4..a90bc87 100644 --- a/docs/setup/troubleshooting.md +++ b/docs/setup/troubleshooting.md @@ -30,7 +30,7 @@ **A token is "not yet valid".** Check the machine's clock: as in FOCA, there's no leeway. -**A node answers 502 with `refused: userinfo`.** The node couldn't find out the entitlements: `entitlements_error` in its row says why. This isn't a decision about the user. Perhaps the exchanged token lacks a scope for user info: see `TESTBED_EXCHANGE_SCOPE`. +**A node answers 502 with `refused: userinfo`.** The node couldn't find out the entitlements: `entitlements_error` in its row says why, e.g., a claim in `TESTBED_ENTITLEMENT_CLAIMS` that isn't a list of strings. This isn't a decision about the user. Perhaps the exchanged token lacks a scope for user info: see `TESTBED_EXCHANGE_SCOPE`. **A node answers 403 for a member of the group.** The release is probably missing on the exchanging client ([C4](../testbed/assumptions.md#constraints)). Check `entitlement_claims` in the node's row, too: if it's empty, user info held none of the claims in `TESTBED_ENTITLEMENT_CLAIMS`. Compare with what `userinfo` shows, and add the claim that holds them. diff --git a/docs/testbed/assumptions.md b/docs/testbed/assumptions.md index 21689ed..0e3cdf5 100644 --- a/docs/testbed/assumptions.md +++ b/docs/testbed/assumptions.md @@ -80,6 +80,6 @@ The `/oidc/` document again, on 2026-11-13, for [delegated access](delegated-acc - **Listed:** the scope `offline_access`; the grants `refresh_token` and token exchange; a revocation endpoint, `https://login.aai.lifescience-ri.eu/oidc/revoke`; an introspection endpoint; the token endpoint authentication methods `client_secret_basic`, `client_secret_post` and `none`. - **Not listed:** `prompt_values_supported`, `dpop_signing_alg_values_supported`, `tls_client_certificate_bound_access_tokens` and `backchannel_logout_supported`. A missing field doesn't prove that a feature is missing, but no standard way of binding tokens to a client instance is advertised ([C11](#constraints)). -Entitlements as LS Login released them to other clients of the `/oidc/` issuer (read on 2026-11-12 and 2026-11-15, recorded in [generic-issues#46](https://github.com/elixir-cloud-aai/generic-issues/issues/46)): in the claim **`eduperson_entitlement`**, not `entitlements`, and in user info only. The access token carried the scope `eduperson_entitlement`, but not the values. Which claim the testbed's clients get with the scope `entitlements` is unknown until [T1](../tests/t1-call-chain.md) and [T3](../tests/t3-groups.md) have run, so the node reads both. +Entitlements as LS Login released them to other clients of the `/oidc/` issuer (read on 2026-11-12 and 2026-11-15, recorded in [generic-issues#46](https://github.com/elixir-cloud-aai/generic-issues/issues/46)): in the claim **`eduperson_entitlement`**, not `entitlements`, and in user info only. The access token carried the scope `eduperson_entitlement`, but not the values. Which claim the testbed's clients get with the scope `entitlements` is unknown until [T1](../tests/t1-call-chain.md) and [T3](../tests/t3-groups.md) have run, so the node reads both, and trusts them equally. That's only safe if LS Login fills both from Perun's groups, not from attributes of a user's home organisation, which nothing public says. Once T3 has shown which claim the clients get, set `TESTBED_ENTITLEMENT_CLAIMS` to that one. A login token of Krini's, seen by us on 2026-10-20: `typ` was `at+jwt`, and `aud` held the client's ID. diff --git a/docs/tests/t3-groups.md b/docs/tests/t3-groups.md index d598184..46b3e19 100644 --- a/docs/tests/t3-groups.md +++ b/docs/tests/t3-groups.md @@ -33,7 +33,7 @@ tb> exchange to-node-s --as gateway --from to-gw --audience @node --scope "openi tb> userinfo to-node-s ``` -The node reads entitlements from `entitlements` and `eduperson_entitlement` (`TESTBED_ENTITLEMENT_CLAIMS`), and its row names the claims it found them in (`entitlement_claims`). Note which of the two `userinfo user` shows. If it shows neither, try the other scope once, and note whether the registration allows it: +The node reads entitlements from `entitlements` and `eduperson_entitlement` (`TESTBED_ENTITLEMENT_CLAIMS`), and its row names the claims it found them in (`entitlement_claims`). Note which of the two `userinfo user` shows. If it shows neither, log in with account A again, with the other scope, once, and note whether the registration allows it: ```text tb> login u2 --as client --scope "openid eduperson_entitlement offline_access" @@ -107,7 +107,7 @@ We derived the example from a known entitlement of the same form ([A12](../testb | Step | Record | Result | |---|---|---| | Release per client | The entitlements for each line. Does `introspect --as node` differ? Does the exchange need the `scope`? | | -| Exact value | The entitlement in user info, compared with `TESTBED_REQUIRED_ENTITLEMENT`; the claim it came in (`entitlements` or `eduperson_entitlement`) and the scope it took | | +| Exact value | The entitlement in user info, compared with `TESTBED_REQUIRED_ENTITLEMENT`; the claim it came in (`entitlements` or `eduperson_entitlement`) and the scope it took: `entitlements`, or `eduperson_entitlement` from `u2`, and whether the registration allowed that | | | Account A | Status, `policy` and `entitlement_claims` at the node | | | Account B | Login, exchange, status and `refused` at the node | | | Group release | Which role it took, and who granted it | TrustedFacilityAdmin within the relevant VO; not granted for this setup, so the VO admins assign groups on request ([Client registration](../setup/client-registration.md#who-can-assign-groups)) | diff --git a/src/testbed/service.py b/src/testbed/service.py index da954fc..7d467ee 100644 --- a/src/testbed/service.py +++ b/src/testbed/service.py @@ -111,39 +111,51 @@ def _entitlements(self, token: str, claims: dict[str, Any]) -> dict[str, Any]: """Get the user's entitlements from user info, as computed for this token. The values are the union of all configured claims, in order of - appearance, as providers differ in the claim they release them in. + appearance, as providers differ in the claim they release them in. A + claim that is `null` counts as absent. A claim of another type is + skipped and named in `error`: the policy then allows the user only if + another claim holds the entitlement, and otherwise makes no decision. Args: token: Validated access token. claims: Verified claims of the token. Returns: - Entitlements and the names of the claims they were read from, or - the reason why there are none to show. + Entitlements, the names of the claims they were read from, and the + reason why some or all couldn't be read, if any. """ try: userinfo = self.tokens.userinfo(token) except Refused as exc: - return {"values": [], "error": exc.view()} + return {"values": [], "claims": [], "error": exc.view()} except Exception: logger.exception("User info request failed") - return {"values": [], "error": "user info request failed"} + return {"values": [], "claims": [], "error": "user info request failed"} if userinfo.get("sub") != claims.get("sub"): - return {"values": [], "error": "user info is about another subject"} + return { + "values": [], + "claims": [], + "error": "user info is about another subject", + } values: dict[str, None] = {} sources = [] + invalid = [] for name in self.settings.entitlement_claims: - if name not in userinfo: + found = userinfo.get(name) + if found is None: continue - found = userinfo[name] found = [found] if isinstance(found, str) else found if not isinstance(found, list) or not all( isinstance(item, str) for item in found ): - return {"values": [], "error": f"{name} is not a list of strings"} + invalid.append(name) + continue sources.append(name) values.update(dict.fromkeys(found)) - return {"values": list(values), "claims": sources} + result: dict[str, Any] = {"values": list(values), "claims": sources} + if invalid: + result["error"] = f"{', '.join(invalid)}: not a list of strings" + return result def check(self, headers: Any) -> RequestContext: """Check an incoming request. diff --git a/tests/test_services.py b/tests/test_services.py index 42b1b9a..0f8f8fc 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -487,19 +487,58 @@ def test_no_entitlement_claim_is_403_and_names_no_claim( assert response.get_json()["entitlements"] == {"values": [], "claims": []} +@pytest.mark.parametrize( + ("good", "status", "policy"), + [([ENTITLEMENT], 200, "allowed"), (["urn:a"], 502, "unknown")], + ids=["entitlement in the other claim", "entitlement nowhere"], +) def test_a_wrong_type_in_one_claim_names_that_claim( + node: FlaskClient, + provider: FakeProvider, + good: list[str], + status: int, + policy: str, +) -> None: + """An odd claim is skipped and named; only the other claim can allow. + + Args: + node: Test client of the node. + provider: Fake provider. + good: Value of the claim with the right type. + status: Expected status. + policy: Expected decision of the policy. + """ + base = provider.issuer.rstrip("/") + provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( + 200, + {"sub": "user-1", "entitlements": good, "eduperson_entitlement": 1}, + ) + response = node.get("/report", headers=_bearer(provider.mint())) + assert response.status_code == status + body = response.get_json() + assert body["policy"] == policy + assert body["entitlements"] == { + "values": good, + "claims": ["entitlements"], + "error": "eduperson_entitlement: not a list of strings", + } + + +def test_a_null_claim_counts_as_absent( node: FlaskClient, provider: FakeProvider ) -> None: - """An odd value in one claim is an error, even if the other one is fine.""" + """`null` in a claim isn't an error: the other claim decides.""" base = provider.issuer.rstrip("/") provider.routes[f"{base}/userinfo"] = lambda _url, _kw: FakeResponse( 200, - {"sub": "user-1", "entitlements": [ENTITLEMENT], "eduperson_entitlement": 1}, + {"sub": "user-1", "entitlements": None, "eduperson_entitlement": ENTITLEMENT}, ) response = node.get("/report", headers=_bearer(provider.mint())) - assert response.status_code == 502 - error = response.get_json()["entitlements"]["error"] - assert error == "eduperson_entitlement is not a list of strings" + assert response.status_code == 200 + assert response.get_json()["entitlements"] == { + "values": [ENTITLEMENT], + "claims": ["eduperson_entitlement"], + } def test_entitlement_claims_can_be_configured(provider: FakeProvider) -> None: diff --git a/tests/test_session.py b/tests/test_session.py index bf9871a..26f1911 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -100,6 +100,15 @@ def test_hop_rows_handles_refusals() -> None: rows = hop_rows({"service": "node", "refused": "token", "reason": "audience"}) assert rows[0]["reason"] == "audience" assert rows[0]["sub"] is None + assert rows[0]["entitlement_claims"] is None + + +def test_hop_rows_name_the_entitlement_claims() -> None: + """T3 records which claim the node read entitlements from.""" + entitlements = {"values": ["urn:a"], "claims": ["eduperson_entitlement"]} + rows = hop_rows({"service": "node", "entitlements": entitlements}) + assert rows[0]["entitlements"] == ["urn:a"] + assert rows[0]["entitlement_claims"] == ["eduperson_entitlement"] def test_tamper_changes_only_the_signature(provider: FakeProvider) -> None: From c79ad70d19128358d8c31c06d7e5b0b3c887edf1 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 17 Nov 2026 23:39:10 +0100 Subject: [PATCH 4/4] docs: explain entitlements_error on a 200 row A skipped claim now shows as `entitlements_error` on an allowed request, too. Say so in troubleshooting and the command reference, test that the session's rows carry it, and update the policy's docstring. Co-Authored-By: Claude Opus 5.5 --- docs/about/commands.md | 4 ++-- docs/setup/troubleshooting.md | 2 ++ src/testbed/service.py | 3 ++- tests/test_session.py | 7 ++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/about/commands.md b/docs/about/commands.md index da14f11..c3d9225 100644 --- a/docs/about/commands.md +++ b/docs/about/commands.md @@ -54,9 +54,9 @@ Tokens are kept under names you choose. Targets in `--audience` and `--resource` | `exchange ` | Exchanges a token; `--as` is the exchanging client | `--as `, `--from `, `--audience`, `--resource`, `--scope`, `--requested-type access\|refresh`, `--auth auto\|basic\|post\|none`, `--tamper-subject`, `--no-rules` | | `refresh ` | Redeems the refresh token held by a token of the session | `--as `, `--from `, `--audience`, `--resource`, `--scope` | | `credentials ` | Gets a client's own token | `--as `, `--scope` | -| `call ` | Calls a service with a token and shows what each hop saw, including the node's `entitlements` and the claims they came from (`entitlement_claims`) | `--token `, `--save `, `--hop-limit`, `--traceparent`, `--tamper`, `--id-token`, `--full` | +| `call ` | Calls a service with a token and shows what each hop saw, including the node's `entitlements` the claims they came from (`entitlement_claims`), and why some couldn't be read (`entitlements_error`) | `--token `, `--save `, `--hop-limit`, `--traceparent`, `--tamper`, `--id-token`, `--full` | | `show ` | Shows the decoded claims of a token | | -| `userinfo ` | Calls user info with a token; shows released entitlements, in whichever claim they come | | +| `userinfo ` | Calls user info with a token; shows all released claims, e.g., `entitlements` or `eduperson_entitlement` | | | `introspect ` | Introspects a token as a client | `--as `, `--refresh` | | `revoke ` | Revokes a token as a client | `--as `, `--refresh` | | `wait-expiry ` | Blocks until a token has expired; Ctrl-C ends the wait | `--margin ` | diff --git a/docs/setup/troubleshooting.md b/docs/setup/troubleshooting.md index a90bc87..a6746bd 100644 --- a/docs/setup/troubleshooting.md +++ b/docs/setup/troubleshooting.md @@ -32,6 +32,8 @@ **A node answers 502 with `refused: userinfo`.** The node couldn't find out the entitlements: `entitlements_error` in its row says why, e.g., a claim in `TESTBED_ENTITLEMENT_CLAIMS` that isn't a list of strings. This isn't a decision about the user. Perhaps the exchanged token lacks a scope for user info: see `TESTBED_EXCHANGE_SCOPE`. +**A node answers 200, but its row has `entitlements_error`.** A claim in `TESTBED_ENTITLEMENT_CLAIMS` wasn't a list of strings and was skipped; another claim held the entitlement. Record which claim it was, and what `userinfo` shows in it. + **A node answers 403 for a member of the group.** The release is probably missing on the exchanging client ([C4](../testbed/assumptions.md#constraints)). Check `entitlement_claims` in the node's row, too: if it's empty, user info held none of the claims in `TESTBED_ENTITLEMENT_CLAIMS`. Compare with what `userinfo` shows, and add the claim that holds them. **A service answers 502 with `refused: exchange`.** LS Login refused the next hop's exchange, or couldn't be reached. The row says which. diff --git a/src/testbed/service.py b/src/testbed/service.py index 7d467ee..2eea4f3 100644 --- a/src/testbed/service.py +++ b/src/testbed/service.py @@ -218,7 +218,8 @@ def _apply_policy(self, report: dict[str, Any]) -> None: A user without the entitlement is told so (403) rather than treated as unauthenticated (401), so that portals can offer a way to get access. If - user info gave no answer, nobody knows, so that isn't a 403 (502). + the entitlements couldn't be fully read, and those that could don't hold + it, nobody knows, so that isn't a 403 (502). Args: report: Report of the service, updated with the decision. diff --git a/tests/test_session.py b/tests/test_session.py index 26f1911..cd65c55 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -105,10 +105,15 @@ def test_hop_rows_handles_refusals() -> None: def test_hop_rows_name_the_entitlement_claims() -> None: """T3 records which claim the node read entitlements from.""" - entitlements = {"values": ["urn:a"], "claims": ["eduperson_entitlement"]} + entitlements = { + "values": ["urn:a"], + "claims": ["eduperson_entitlement"], + "error": "entitlements: not a list of strings", + } rows = hop_rows({"service": "node", "entitlements": entitlements}) assert rows[0]["entitlements"] == ["urn:a"] assert rows[0]["entitlement_claims"] == ["eduperson_entitlement"] + assert rows[0]["entitlements_error"] == "entitlements: not a list of strings" def test_tamper_changes_only_the_signature(provider: FakeProvider) -> None: