【发布时间】:2019-07-19 04:42:41
【问题描述】:
我已设置 Active Directory,并希望设置 SSO。我正在使用 Waffles,并且想知道我的 Servlet 中的用户组。如何检索用户的组?
【问题讨论】:
我已设置 Active Directory,并希望设置 SSO。我正在使用 Waffles,并且想知道我的 Servlet 中的用户组。如何检索用户的组?
【问题讨论】:
我使用 WindowsPrincipal 来获取用户组。
WindowsPrincipal p = (WindowsPrincipal)request.getSession().getAttribute("waffle.servlet.NegotiateSecurityFilter.PRINCIPAL");
for(Map.Entry<String, WindowsAccount> entry: p.getGroups().entrySet()){
System.out.println(entry.getValue().getName); //The is the group that the user memberOf
}
【讨论】: