我正在尝试从我们的ldap系统中的用户那里获取角色。
首先,我的ldap用户条目和角色条目:
@Data
@Entry(objectClasses = {"inetOrgPerson", "top"}, base = "ou=people"
public class LdapUserEntry {
@Id
private Name id;
@DnAttribute(value = "uid")
private String username;
@Attribute(name = "cn")
private String cn;
@Attribute(name = "userPassword")
private String password;
@DnAttribute(value = "ou")
@Transient
private String group;
}
角色输入课程:
@Data
@Entry(objectClasses = {"groupOfUniqueNames", "top"}, base = "ourBase")
public class LdapRoleEntry {
@Id
private Name dn;
@DnAttribute("cn")
private String name;
@Attribute(name = "uniqueMember")
@Transient
private List<String> members;
}
对于我们的授权和身份验证,我需要在用户登录之前从ldap获取角色。
编辑:我的回购看起来像:
public interface LdapUserRepository extends LdapRepository<LdapUserEntry> {
LdapUserEntry findByUsername(String username);
}
public interface LdapRoleRepository extends LdapRepository<LdapRoleEntry> {
}
谢谢!