如何将额外的参数传递给Keycloak的EvaluationContext?

时间:2018-05-23 14:02:37

标签: keycloak

是否可以通过The Evaluation Context传递额外的属性?我想基于地理位置信息创建JavaScript策略,其中(webapp)客户端将国家/地区代码作为运行时属性传递。所以政策看起来像这样:

var context = $evaluation.getContext();
var attr = context.getAttributes();
var geoloc = attr.getValue('notkc.country_of_origin'); //gets passed to the auth request

if (VALID_COUNTRIES.indexOf(geoloc)) > -1) {
    $evaluation.grant();
}

a mailing list discussion back in February 2017其中一位核心团队成员(佩德罗)表示目前不可能,但正在考虑之中。半年后有a JIRA issue 5457表示可以从资源许可中获得,但我不知道这是如何工作的。

更新:通过Claim Information Point在某些时候添加了支持:它可以使用各种来源(HTTP请求,...)将信息推送到上下文中。

0 个答案:

没有答案