2013-11-14 49 views
2

我试图从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”:{ “用户id”: “USER1”, “属性”:{ “AuthenticationDate”:“星期四11月14日22点39分35秒EST 2013“},”isUserAuthenticated“:1,”displayName“:”Fred Flintstone“},”WL-Authentication-Success“:{”BasicAuthRealm“:{”userId“:”user1“,”attributes“:{”AuthenticationDate“ :“Thu Nov 14 22:39:35 EST 2013”​​},“isUserAuthenticated”:1,“displayName”:“Fred Flintstone”}},

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

任何想法?

回答

1

在用户成功通过身份验证后,不会将组对象发送回客户端。发送回来的UserIdentity对象的唯一部分是名称,显示名称和属性。我不知道这些团体没有被退回的原因。也许对象的目的只是为了服务器,并没有打算被客户使用。

不幸的,但简单的解决方法是将您需要了解的关于您的组的任何信息添加到您的属性对象。