Will add some examples to docs. The 'getResource().getAttributes()' returns
a map. Here is an example
https://github.com/pedroigor/keycloak/blob/49407c2e4f870659e1d5a00c7fd6cf...
.
On Fri, Jul 6, 2018 at 9:48 AM, Corentin Dupont <corentin.dupont(a)gmail.com>
wrote:
Hello,
I'm trying to experiment with resource attributes...
However I don't find it in the doc (yet).
Creating attributes like this seems to work:
curl -X POST "
http://localhost:8080/auth/realms/waziup/authz/protection/resource_set" -H
"Authorization: Bearer $CLIENTTOKEN" -H "Content-Type:
application/json" -d
'{"name":"Sensortest3",
"attributes":{"isPrivate": ["true"]}}'
However, I'm not sure about the Javascript policy:
var context = $evaluation.getContext();
var permission = $evaluation.getPermission();
var identity = context.getIdentity();
if (permission.getResource().getAttributes().containsValue('isPrivate',
'false')) {
$evaluation.grant();
}
Thanks!!
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user