spring-guides/gs-authenticating-ldap

spring 3.1 generates deprecated code

Closed this issue · 4 comments

Guide: https://spring.io/guides/gs/authenticating-ldap/

indicates that: src/main/java/com/example/authenticatingldap/WebSecurityConfig.java
contains:
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin();

Unfortunately both authorizeRequests and formLogin are flagged as deprecated in Spring 3.1
The method authorizeRequests() from the type HttpSecurity is deprecated

What is the correct code to use? Can the guide be updated please

Fixed by 0ef27b3

Thank you.
This is probably the wrong place to ask (sorry!) however google and docs are not helping me, with this version of the code, how do I tell LDAP to 'bind' for it's initial connection? My corporate server is rejecting the connection (works fine with the local ldif ldap):
Caused by: javax.naming.NamingException: [LDAP: error code 1 - 000004DC: LdapErr: DSID-0C090CF4,
comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4563

I would ask that question on Stack Overflow. Still, we may be able to get an answer if we loop in an expert. Paging @jzheaux.

Thank you, I'd already searched Stack Overflow and found many related to older Spring, and one that covers the exact issue I have:

https://stackoverflow.com/questions/69192599/spring-security-ldap-bind-must-be-completed-on-the-connection

However the answer given hasnt been accepted and doesnt seem to help anyway.
If an expert here can confirm the right method for this latest version (and add to the guide?) it'd be ideal.
And to clarify - I need to bind using the users provided creds rather than a distinct manager id