无法检索用户角色 [英] Can't retrieve user roles

查看:125
本文介绍了无法检索用户角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to return a list of roles back to a mobile client device from the WL server

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

In the createIdentity method of my LoginModule I added the following code

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返回到移动设备,返回自定义属性,但小组信息似乎在某处丢失。

The display Name "Fred Flintstone" gets returned to the mobile device, the custom attributes get returned, but the group information seems to get lost somewhere.

我在移动设备日志中显示以下信息

I get the following displayed in the mobile device logs

BasicAuthRealm:{userId:user1,attributes:{AuthenticationDate:Thu Nov 14 22:39:35 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}},

"BasicAuthRealm":{"userId":"user1","attributes":{"AuthenticationDate":"Thu Nov 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运行

I am running WL 6.0.0.1 Enterprise edition and running against a Liberty server v8.5.5.0

任何想法?

推荐答案

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

The groups object is not sent back to the client after the user successfully authenticates. The only parts of the UserIdentity object that are sent back are the name, displayName, and the attributes. I do not know the reason that the groups aren't sent back. Perhaps the objects purpose was only meant for the server and was never intended to be used by the client.

不幸但容易的解决方法是添加您需要知道的任何信息关于你的属性对象的组。

The unfortunate but easy workaround is to add any information you need to know about your group to your attributes object.

这篇关于无法检索用户角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆