Skip to content

Commit 614a8d6

Browse files
weltekialexellis
authored andcommitted
Add example for matching roles based on group membership
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent 91bf34a commit 614a8d6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/openfaas-pro/iam/example-auth0.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,21 @@ Every condition must return true for the Role to be considered as a match.
5252

5353
The principal field is optional, however if it is given, both the principal and the condition must match. If there are multiple items given, then only one must match the token.
5454

55-
If you configure Auth0 to emit a "group" claim such as "example.com/group", you could match this with a condition, instead of specifying individual "sub" fields.
55+
56+
### Match on group membership
57+
58+
If you configure Auth0 to emit a "group" claim such as "openfaas-dev", you could match this with a condition, instead of specifying individual "sub" fields.
59+
60+
Groups are often represented as a list in the JWT so the `ForAnyValue` set operator can be used for this:
61+
62+
```yaml
63+
condition:
64+
ForAnyValue:StringEqual:
65+
jwt:groups: [ "openfaas-dev" ]
66+
67+
```
68+
69+
### Match on email
5670

5771
A user's email could also be fuzzy matched with a condition, for example:
5872

@@ -62,6 +76,8 @@ A user's email could also be fuzzy matched with a condition, for example:
6276
jwt:email: ["*@example.com"]
6377
```
6478

79+
For an overview of all supported condition operators see: [OpenFaaS IAM language](/openfaas-pro/iam/overview/#openfaas-iam-language).
80+
6581
## Bind a Policy to a Role
6682

6783
Finally, one or more Policies must be created which describe which permissions a user has, and on which resources.

0 commit comments

Comments
 (0)