Skip to content

Conversation

@therepanic
Copy link
Contributor

Replaces SpringSecurityLdapTemplate with LdapClient for user search operations.

Closes: gh-17291

LdapClient ldapClient = LdapClient.builder()
.contextSource(contextSource)
.defaultSearchControls(() -> searchControls)
.ignorePartialResultException(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpringSecurityLdapTemplate#searchForSingleEntryInternal behavior also ignores partial result exceptions.

Comment on lines 318 to +338
}
catch (org.springframework.ldap.NamingException ex) {
throw badCredentials(ex);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what you should do, otherwise the tests will fail.

Comment on lines -100 to +101
given(this.ctx.search(any(Name.class), eq(customSearchFilter), any(Object[].class), any(SearchControls.class)))
given(this.ctx.search(any(Name.class), any(String.class), any(SearchControls.class)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure whether this is a breaking change or not. Because when switching to LdapClient, we don't accept any(Object[].class) as the fourth argument, so we don't need to mock it.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 1, 2026
@therepanic
Copy link
Contributor Author

I don't quite understand whether this is breaking Change or not, please take a look at #18627 (comment)

Replaces SpringSecurityLdapTemplate with LdapClient for user search
operations.

Closes: spring-projectsgh-17291

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
@rwinch
Copy link
Member

rwinch commented Feb 2, 2026

FYI I rebased based off origin/main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change ActiveDirectoryLdapAuthenticationProvider to use LdapClient

3 participants