gpt4 book ai didi

java - 如何使用 Waffle 检索用户的组/角色?

转载 作者:行者123 更新时间:2023-11-28 23:11:44 27 4
gpt4 key购买 nike

我已经设置了 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
}

关于java - 如何使用 Waffle 检索用户的组/角色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57105645/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com