Spring LDAP,检查指定组中用户的成员身份 [英] Spring LDAP, check the membership of user in specified group

查看:63
本文介绍了Spring LDAP,检查指定组中用户的成员身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在为LDAP中指定组中的用户创建具有特殊特权的应用程序,我使用Spring Security登录,但是我不知道如何检查用户组.

目的是向所有ldap用户表显示数据,如果某人属于ldap中的组,它还会显示用于更改该数据的按钮.

那么如何检查属于LDAP用户组的用户呢?


I'm creating an app with a special privileges for a user which is in specified group in LDAP, I'm logging in using spring security, but I have no idea how to check the group of the user.

The goal is to show all of the ldap users table with data, and if someone belongs to a group in ldap it shows also buttons to change that data.

So how to check belonging to group of an LDAP user?

问候,拉法(Rafał)!

Greetings, Rafał !

推荐答案

使用它来验证特定组中用户的身份验证

Use this to verify authentication of user in specific group

 FilterBasedLdapUserSearch search = new FilterBasedLdapUserSearch(
  "OU=users,DC=mycompany,DC=com",
  "(&(objectCategory=user)(objectClass=person)(sAMAccountName={0})" +
  "(memberof:=CN=entergroup,OU=Users,DC=mycompany,DC=com)" +")", contextsource );

希望这会有所帮助.

这篇关于Spring LDAP,检查指定组中用户的成员身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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