我使用了基于适配器的身份验证,并设置了userIdentity
. 现在我试图获取loginname
和username
使用 Worklight API 的WL.Client.getUserName(realm)
and WL.Client.getLoginName(realm)
,但是这两个 API 调用都NULL
作为结果返回。我已经使用下面的代码在适配器中设置了用户身份。当对基于适配器的身份验证进行身份验证时,我只是不知道如何设置用户的username
and 。loginname
我可以userId
通过WL.Client.getUserInfo(realm, "userID")
.
如何设置username
和loginname
?
var userIdetity={
userId : "kawin",
disaplyName : "Kawinesh",
attributes : {
foo : "bar"
}
};
WL.Server.setActiveUser(realmname,userIdentity);