Skip to content

Support nested claim paths in policy conditions - #30

Open
arber-salihi wants to merge 2 commits into
mainfrom
feat/nested-claim-paths
Open

Support nested claim paths in policy conditions#30
arber-salihi wants to merge 2 commits into
mainfrom
feat/nested-claim-paths

Conversation

@arber-salihi

Copy link
Copy Markdown
Member

Summary

Adds support for referencing nested token claims in policy conditions via dot-notation. A condition's field (and central required_claims/forbidden_claims) may now address a claim inside a nested object:

conditions:
  - field: "app_metadata.preferences.theme"
    pattern: "^dark$"

For a token containing {"app_metadata": {"preferences": {"theme": "dark"}}}, this matches against dark.
(In real life, you probably don't want to authorize callers against such claims, though...)

NOTES
A literal top-level key takes precedence over path traversal.
As such, existing flat claims (repository, ref, sub, etc.) are completely unaffected.

Testing

  • Unit tests (provider_test.go): top-level, nested, deeply-nested, missing keys, descending past a leaf, non-string leaves (bool/array), and literal-key precedence.
  • Integration test + fixture (nested_claim.tpl.yaml) exercising a nested-path match end-to-end.
  • go build, go vet, and gofmt clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant