0
私は、私のスクリプトで生成する2つの属性(otpexpiry
およびotpvalue
)で検索したユーザーをOpenIDMで更新するカスタムjsエンドポイントを開発しようとしています。OpenIDMは、カスタムエンドポイント上のユーザー属性を更新します
私はリンクにopenidm/conf/endpoint-otp.json
でJSON confに追加:
{
"context" : "endpoint/otp/*",
"type" : "text/javascript",
"file" : "script/otp.js"
}
そして、これは私のスクリプトopenidm/script/otp.js
次のとおりです。
(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};
}
})();
どのように私は、検索ユーザーの2つの変数を更新することができますか?