spring-projects / spring-projects/spring-security
Docs: WebFlux security example uses deprecated builder-style API Expected Behavior
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Expected Behavior
The documentation for ServerHttpSecurity should showcase the modern, non-deprecated Lambda DSL style for configuring SecurityWebFilterChain. This is the current best practice and provides a future-proof example for users.
The code example should look like this:
import org.springframework.security.config.Customizer;
// ...
@Bean
public SecurityWebFilterChain securityFilterChain(ServerHttpSecurity http) {
http
.authorizeExchange(authorize -> authorize.anyExchange().authenticated())
.httpBasic(Customizer.withDefaults())
.formLogin(Customizer.withDefaults());
return http.build();
}
Current Behavior
The documentation currently displays an example using the older, builder-style configuration. This uses several methods that were formally deprecated in Spring Security 6.1, including .authorizeExchange(), .and(), .httpBasic(), and .formLogin().
This is the code currently shown in the documentation:
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http
.authorizeExchange()
.anyExchange().authenticated()
.and()
.httpBasic().and()
.formLogin();
return http.build();
}
Context
As a developer learning how to configure WebFlux security, I used the official documentation as my primary guide. When I implemented the provided example, my IDE immediately flagged all the chained methods as deprecated.
This can be confusing for new users, as it creates uncertainty about whether they are following the correct and most current best practices. The only workaround is to have prior knowledge of the Lambda DSL and to know that the documentation is out of sync with the API's current state.
Updating this example would provide a clearer, more modern learning path for developers and ensure the documentation accurately reflects the recommended approach for configuring Spring Security.
I am happy to submit a pull request to update the relevant documentation file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the WebFlux security documentation example for ServerHttpSecurity and SecurityWebFilterChain, then compare it with the modern Lambda DSL example provided in the issue. Replace the deprecated builder-style snippet with the requested configuration and verify that the documentation shows the current non-deprecated API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- documentation, security
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100