Repository navigation
feat(OMN-15877): add OmniWeb principal identity claim #2726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,24 @@ def test_omniweb_allows_the_managed_staging_callback() -> None: | |
|
|
||
| assert "https://dev.app.omninode.ai/*" in omniweb["redirectUris"] | ||
| assert "https://dev.app.omninode.ai" in omniweb["webOrigins"] | ||
|
|
||
|
|
||
| def test_omniweb_user_identity_claim_contract() -> None: | ||
| config = json.loads(_CONFIG_PATH.read_text()) | ||
| omniweb = _client(config, "omniweb") | ||
| mappers = {mapper["name"]: mapper for mapper in omniweb["protocolMappers"]} | ||
|
|
||
| principal = mappers["principal_id"] | ||
| assert principal["protocolMapper"] == "oidc-usermodel-attribute-mapper" | ||
| assert principal["config"]["user.attribute"] == "principal_id" | ||
| assert principal["config"]["claim.name"] == "principal_id" | ||
| assert principal["config"]["id.token.claim"] == "true" | ||
| assert principal["config"]["access.token.claim"] == "true" | ||
| assert principal["config"]["userinfo.token.claim"] == "true" | ||
|
|
||
| assert "gateway-attach-audience" not in mappers | ||
| assert all( | ||
| mapper.get("config", {}).get("included.custom.audience") | ||
| != "gateway-attach" | ||
| for mapper in mappers.values() | ||
| ) | ||
|
Comment on lines
+44
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -C 8 \
'"gateway-attach"|gateway-attach-audience|included.custom.audience' \
docker/keycloak/desired-clients.json \
scripts/tests/test_keycloak_desired_clients_contract.pyRepository: OmniNode-ai/omnibase_infra Length of output: 1630 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- test file ---'
cat -n scripts/tests/test_keycloak_desired_clients_contract.py
printf '%s\n' '--- relevant Keycloak declarations ---'
rg -n -C 12 \
'gateway-attach|omniweb|clientScopes|clientScope|protocolMappers|audience' \
docker scripts \
-g '*.json' -g '*.py' -g '*.sh'
printf '%s\n' '--- repository-wide references ---'
rg -n -C 5 'gateway-attach|gateway-attach-audience' .Repository: OmniNode-ai/omnibase_infra Length of output: 50382 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
import json
from pathlib import Path
path = Path("docker/keycloak/desired-clients.json")
config = json.loads(path.read_text())
print("top-level keys:", sorted(config))
print("client scopes:")
for scope in config.get("clientScopes", []):
print(json.dumps({
"name": scope.get("name"),
"protocol": scope.get("protocol"),
"mappers": scope.get("protocolMappers", []),
}, sort_keys=True))
print("clients:")
for client in config.get("clients", []):
if client.get("clientId") == "omniweb":
print(json.dumps({
"clientId": client.get("clientId"),
"defaultClientScopes": client.get("defaultClientScopes", []),
"optionalClientScopes": client.get("optionalClientScopes", []),
"protocolMappers": client.get("protocolMappers", []),
}, indent=2, sort_keys=True))
PY
printf '%s\n' '--- exact gateway references in configuration and tests ---'
rg -n 'gateway-attach|gateway-attach-audience' \
docker/keycloak/desired-clients.json \
scripts/tests/test_keycloak_desired_clients_contract.py \
scripts/tests/test_seed_keycloak_clients.py || true
printf '%s\n' '--- focused diff ---'
git diff --stat -- scripts/tests/test_keycloak_desired_clients_contract.py docker/keycloak/desired-clients.json
git diff -- scripts/tests/test_keycloak_desired_clients_contract.py docker/keycloak/desired-clients.jsonRepository: OmniNode-ai/omnibase_infra Length of output: 2032 Add a positive The desired configuration defines no 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Assert the configured JSON type.
docker/keycloak/desired-clients.jsonLines 54-63 setconfig["jsonType.label"]to"String", but this contract does not check it. Add the assertion so a non-stringprincipal_idclaim cannot pass the test.Proposed assertion
assert principal["config"]["userinfo.token.claim"] == "true" + assert principal["config"]["jsonType.label"] == "String"📝 Committable suggestion
🤖 Prompt for AI Agents