Open Issues Need Help
View All on GitHub [Help] Secured endpoint always returns 401 Unauthorized when return type is CompletableFuture<T>. 3 months ago
AI Summary: Debug and fix a Spring Boot REST API endpoint that returns a 401 Unauthorized error when using CompletableFuture and @PreAuthorize annotation. The issue stems from the SecurityContext not being propagated to the asynchronous task, resulting in an anonymous context within the service method. The solution involves correctly configuring the thread pool executor to maintain the security context across threads.
Complexity:
4/5
enhancement help wanted good first issue question
Spring REST Api for managing client requests
Java
#rest-api#spring-boot#spring-security