无法检索用户角色

时间:2013-11-14 11:50:39

标签: ibm-mobilefirst worklight-security

我正在尝试从WL服务器返回一个角色列表回移动客户端设备

在我的LoginModule的createIdentity方法中,我添加了以下代码

HashMap<String, Object> customAttributes = new HashMap<String, Object>();
customAttributes.put("AuthenticationDate", new Date());

Set<String> groups = new HashSet<String>();
groups.add("Managers");
groups.add("Users");

UserIdentity identity = new UserIdentity(loginModule, USERNAME, "Fred Flintstone", groups, customAttributes, PASSWORD);

显示名称“Fred Flintstone”返回到移动设备,返回自定义属性,但组信息似乎在某处丢失。

我在移动设备日志中显示以下内容

“BasicAuthRealm”:{“userId”:“user1”,“attributes”:{“AuthenticationDate”:“Thu Nov 14 22:39:35 2013 2013”​​},“isUserAuthenticated”:1,“displayName”:“ Fred Flintstone“},”WL-Authentication-Success“:{”BasicAuthRealm“:{”userId“:”user1“,”attributes“:{”AuthenticationDate“:”Thu Nov 14 22:39:35 2013“}, “isUserAuthenticated”:1,“displayName”:“Fred Flintstone”}},

我正在运行WL 6.0.0.1企业版并针对Liberty服务器v8.5.5.0

运行

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

用户成功进行身份验证后,不会将groups对象发送回客户端。发回的UserIdentity对象的唯一部分是name,displayName和属性。我不知道这些团体没有被送回的原因。也许对象的目的仅仅是针对服务器,而且从不打算由客户端使用。

不幸但容易的解决方法是将您需要了解的有关组的任何信息添加到属性对象中。