Skip to content
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

docs(jans-cedarling): shorten conditional #10812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/cedarling/cedarling-krakend.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ To test the plugin, you will need:
resource is gatewayDemo::HTTP_Request
)
when {
((principal has "access_token") && ((principal["access_token"]) has "scope")) && (((principal["access_token"])["scope"]).contains("profile"))
((principal["access_token"])["scope"]).contains("profile")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must check for presence of nested, optional attributes one layer at a time. For example, to check for the presence of principal.custom.project where both custom and project are optional, you must first check if principal has a custom attribute and then check that it principal.custom has a project attribute:

https://docs.cedarpolicy.com/policies/syntax-operators.html#operator-has

};
```
- This policy will allow access so long as the access token contains the `profile` scope.
Expand Down
2 changes: 1 addition & 1 deletion jans-cedarling/cedarling-krakend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ To test the plugin, you will need:
resource is gatewayDemo::HTTP_Request
)
when {
((principal has "access_token") && ((principal["access_token"]) has "scope")) && (((principal["access_token"])["scope"]).contains("profile"))
((principal["access_token"])["scope"]).contains("profile")
};
```
- This policy will allow access so long as the access token contains the `profile` scope.
Expand Down
Loading