密钥斗篷中的JavaScript策略

时间:2018-12-03 11:39:40

标签: keycloak

如何查找identity.attributes中存在的所有属性?

var context = $evaluation.getContext();
var permission = $evaluation.getPermission();
var resource = permission.getResource();
var identity = context.getIdentity();
print(identity.attributes)

if (identity.id == resource.owner) {
    $evaluation.grant();
}

1 个答案:

答案 0 :(得分:1)

尝试添加此内容:

var attributes = identity.getAttributes();
print('user attributes: ' + attributes.toMap().keySet());