Closed thinkingmik closed 5 years ago
hi @thinkingmik !
Please, check the krakend-cel module and this part of the config used in the integration test: https://github.com/devopsfaith/krakend-ce/blob/master/tests/fixtures/krakend.json#L121-L145
Your example could be defined as:
"check_expr": "JWT.roles.exists(r, r.matches('(\b)?+(.guest.)+(\b)?') || r.matches('(\b)?+(.admin.)+(\b)?'))"
You can use regex, other macros, boolean operations, etc over any part of the received JWT. More details at the documentation: https://www.krakend.io/docs/endpoints/common-expression-language-cel/
Cheers!
This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.
Hello,
I'm using this Krakend plugin for JWT validation, in particular I'm focusing on the ACL validation functionality:
roles_key
androles
.It works well, but for a project I need to check if a given role contains words. With this plugin is not possible to do this but only check if the the given role is in the roles list.
So my suggestion is:
roles_regex
:true/false
In the method
CanAccess
, if the previous propertyroles_regex
exists and it istrue
do something like this instead of the standard check:In this way I'm able to grant access at roles:
What do you think about this possbile enhancement?