简体   繁体   English

如何在Spring ldap中使用跳过值进行分页

[英]How to paginate in spring ldap using skip value

Can any body help me on how I can find some record from LDAP using springldap. 任何人都可以帮助我如何使用springldap从LDAP查找一些记录。

My problem is, I have created a rest service and it accepts some parameter. 我的问题是,我创建了一个REST服务,它接受了一些参数。 One is offset and another is limit. 一个是抵消而另一个是极限。 Offset parameter escape some record like if my ldap server have 500 record. 偏移参数转义一些记录,例如我的ldap服务器有500条记录。 Now if I give offset value 1 and LIMIT is 100. then it should give first 100 record from ldap. 现在,如果我给出偏移值1且LIMIT为100,那么它应该给出ldap的前100条记录。 If I give offset value 100 and LIMIT is 100, then it should give 100 record after first 100 record from ldap. 如果我给偏移量值100并且LIMIT是100,那么它应该在ldap的前100条记录之后给出100条记录。 If I give offset value 50 and LIMIT is 10, then it should give 10 record after first 50 record from ldap. 如果我给偏移值50而LIMIT为10,那么它应该在ldap的前50条记录之后给出10条记录。

I am stuck on how to set offset value in spring ldap template. 我被困在如何在春季ldap模板中设置偏移值。 I have set limit value and it is working fine. 我已经设置了极限值,并且工作正常。

I am sharing peace of code. 我分享代码的和平。

public OrganisationGroups getOrganisationGroup() 
{

    SearchControls controls = new SearchControls();

    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    controls.setCountLimit(MAXIMUM_SEARCH_GROUP_COUNT);
    AndFilter filter = new AndFilter();
    filter.and(new EqualsFilter("objectclass", "groupOfUniqueNames"));
    List<OrganisationGroup> organisationGroup = ldapTemplate.search("", filter.toString(), controls, new GroupSearchMapper());

    OrganisationGroups groups = new OrganisationGroups();
    groups.setOrganisationGroup(organisationGroup);
    groups.setCount(organisationGroup.size());
    return groups;
}

In this code I have set MAXIMUM_SEARCH_GROUP_COUNT variable to find out maximum record from ldap. 在此代码中,我设置了MAXIMUM_SEARCH_GROUP_COUNT变量以从ldap中找出最大记录。 But I am not able to set parameter or any other way to escape some records from beginning. 但是我无法设置参数或任何其他方式来从一开始就转义一些记录。

Your best option is to use the Virtual List View request control (link to specification ) also known as VLV. 最好的选择是使用虚拟列表视图请求控件(指向规范的链接),也称为VLV。 Note that to use VLV, you will need to make configuration changes on your LDAP server (I assume you are using OpenDJ, which supports VLV ). 请注意,要使用VLV,您将需要在LDAP服务器上进行配置更改(我假设您正在使用支持VLV的 OpenDJ)。

There is a code example for JNDI LDAP provider with the VLV request control at this forum . 论坛上有一个带有VLV请求控件的JNDI LDAP提供程序代码示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Spring LDAP模板连接到AWS Simple AD LDAP - How to connect to AWS Simple AD LDAP using Spring LDAP Template 如何使用spring在ldap中执行搜索操作 - How to perform search operation in ldap using spring 使用Spring ldap模板,如何在没有第二个ldap调用的情况下,设法获取存储在第一个找到的ldap条目的属性中的dn的ldap条目 - using spring ldap template how to manage to get ldap entry of dn stored in attribute of first found ldap entry without second ldap call 如何使用spring security(spring boot)实现Ldap身份验证 - how to achieve Ldap Authentication using spring security(spring boot) 使用LDAP和spring LDAP API进行身份验证,而不使用spring安全性 - Authenticating using LDAP with spring LDAP API and without using spring security 如何使用REST和Spring安全性通过ldap使用Angular登录 - How to Login with Angular by ldap with using Rest and Spring security 如何使用Spring和Java从LDAP获取userPassword属性 - How get userPassword attribute from LDAP using Spring and Java 如何使用Spring Ldap在Active Directory中对用户进行身份验证和搜索 - How authenticate and search user in Active Directory using Spring Ldap 如何使用Spring从ldap检索只读属性 - How to retrieve read-only attributes from ldap using Spring 使用Spring LDAP在Java中进行身份验证 - Authentication in Java using Spring LDAP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM