我已经在IBM Worklight 6.0中实现了“定制身份验证器和登录模块”。身份验证机制运行良好。
我已经在用户身份对象中设置了自定义属性,例如角色,电子邮件等。
在“登录”模块中,
public UserIdentity createIdentity(String realm) {
Map<String, Object> customAttributes= new HashMap<String, Object>();
customAttributes.put("userName", username);
customAttributes.put("mail", customAttrValue); //customAttrValue - this has the email id
UserIdentity uiObj=new UserIdentity("CustomRealm", username, username, null, customAttributes, password);
return uiObj;
}
现在,我无法使用以下api调用来检索属性值。WL.Client.getUserInfo(“ CustomRealm”,“邮件”);
首先,您需要获取领域的“属性”选项。然后从该组属性中获取“邮件”属性。像这样的东西:
var attrs = WL.Client.getUserInfo("CustomRealm", "attributes");
var email = null;;
if (attrs) {
email = attrs.mail;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句