spring-projects / spring-projects/spring-security
Consider replacing `.flatMap` with `.handle` where appropriate for performance reasons
Open
Nobody has claimed this yet.
in: core
status: feedback-provided
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Hello.
cases like this can be replaced with Reactor's .handle operator to improve the performance.
Something like:
.handle( (t, sink) -> {
try {
sink.next(authenticationManager.authenticate(t));
} catch(Throwable error) {
sink.error(error);
}
})
Or even:
if (a.isAuthenticated()) {
sink.next(a);
} else {
sink.complete();
}
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
Start with core/src/main/java/org/springframework/security/authentication/ReactiveAuthenticationManagerAdapter.java at the linked lines and inspect how the current flatMap flow handles authentication results and errors. Identify other appropriate cases, then ensure any replacements preserve the existing authenticated, unauthenticated, and error behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100