簡體   English   中英

無法使用 spring-data-ldap 從 AD 獲取自定義屬性

[英]not able to fetch custom attributes from AD using spring-data-ldap

我正在使用 spring-data-LDAP 連接到 Active Directory。 我已使用域管理員用戶憑據連接到 AD。 application.properties 配置是,

spring.ldap.urls=ldap://xxx.xxx.xxx.xxx:3268
spring.ldap.username=adprofile
spring.ldap.password=Admin@123#
spring.ldap.base=DC=TEST,DC=COM
spring.data.ldap.repositories.enabled=true 

我創建了一個存儲庫來獲取 AD 數據。

@Repository
public interface EmployeeRepo extends LdapRepository<Employee> {
    List<Employee> findByCn(String cn);
    List<Employee> findBySn(String sn);
    List<Employee> findByEmployeeID(String id);
}

我的員工實體是

    @Entry(base = "ou=Employees", objectClasses = {"top", "person", "organizationalPerson", "user"})
    public class Employee {
        @Id
        @JsonIgnore
        private Name id;
    
    public @Attribute(name = "CN") String cn;
    public @Attribute(name = "sn") String sn;
    public @Attribute(name = "EmployeeID") String employeeID;
    
-- getters and setters
    
    }

當我調用findByCn方法時,我得到了響應,但employeeID 將是 null。 如果我調用findByEmployeeID方法,我會得到一個空響應。

誰能幫忙這是為什么? 我是否需要添加任何配置來獲取這些自定義 AD 屬性?

我正在通過端口3268連接到 AD。 似乎某些屬性只能通過端口389連接到 AD 來獲取。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM