首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenIDM通过自定义终结点更新用户属性

OpenIDM通过自定义终结点更新用户属性
EN

Stack Overflow用户
提问于 2017-06-08 01:15:53
回答 0查看 784关注 0票数 0

我正尝试在OpenIDM中开发一个自定义js端点,在该端点中,我使用在脚本中生成的两个属性(otpexpiryotpvalue)更新搜索到的用户。

我在openidm/conf/endpoint-otp.json中添加了一个json conf来链接:

代码语言:javascript
复制
{
 "context" : "endpoint/otp/*",
 "type" : "text/javascript",
 "file" : "script/otp.js"
}

这是我的脚本openidm/script/otp.js

代码语言:javascript
复制
(function() {
 if(request.method === "update") {
  var five_minutes = 5 * 60 * 1000;
  var timestamp = new Date().getTime();
  var otpexpiry = timestamp + five_minutes;
  var otpvalue = Math.floor(Math.random() * 9999);


  /* Not sure of this code below I have to update the user searched with " otpdate : otpexpiry " and "otp : otpvalue "*/
  var u = request.value;
  var id = "managed/user/" + u._id;
  if (id != null) {
    openidm['update']( ... );
  }

  return {
       method: "update",
       resourceName: request.resourcePath,
       revision: request.revision,
       parameters: request.additionalParameters,
       patch: request.patchpperations,
       context: context.current
       };
  } else {
       throw { code: 500, message: "Unknown request type " + request.method};
  }
})();

如何更新搜索到的用户的两个变量?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44418991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档