Spring 使用 uniqueMember 属性的 LDAP 身份验证
Spring LDAP Authentication using uniqueMember Attribute
当我尝试使用 uid={0},ou=Groups 进行身份验证时,我可以成功登录但无法登录我试图将模式缩小到特定组。
uid={0},CN=ROM,OU=USER,OU=APPOU,ou=群组
我可能需要使用 uniqueMember 属性,但找不到方法。如何仅使用 his/her uid 使用组的 uniqueMember 属性对用户进行身份验证?
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url("ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userDnPatterns("uid={0},CN=ROM,OU=USER,OU=APPOU,ou=Groups");
}
以下是感兴趣的人的方式:
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url(ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userSearchFilter("uid={0}")
.groupSearchBase("CN=ROM,OU=USER,ou=APPOU,ou=Groups")
.groupSearchFilter("uniqueMember{0}");
}
当我尝试使用 uid={0},ou=Groups 进行身份验证时,我可以成功登录但无法登录我试图将模式缩小到特定组。
uid={0},CN=ROM,OU=USER,OU=APPOU,ou=群组
我可能需要使用 uniqueMember 属性,但找不到方法。如何仅使用 his/her uid 使用组的 uniqueMember 属性对用户进行身份验证?
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url("ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userDnPatterns("uid={0},CN=ROM,OU=USER,OU=APPOU,ou=Groups");
}
以下是感兴趣的人的方式:
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url(ldapUrl")
.managerDn("username")
.managerPassword("password")
.and()
.userSearchFilter("uid={0}")
.groupSearchBase("CN=ROM,OU=USER,ou=APPOU,ou=Groups")
.groupSearchFilter("uniqueMember{0}");
}