I’d like to require JWT authentication per method instead of using SecurityWebFilterChain
and authorizeExchange
config.
For example, if I have:
@RestController
@RequestMapping("articles")
class ArticlesController {
@GetMapping
suspend fun getArticle(): ResponseEntity<Map<String, Any?>> {
// Process request
}
@PostMapping
suspend fun addArticle(): ResponseEntity<Map<String, Any?>> {
// Process request
}
}
I only want addArticle()
to require authentication and leave getArticle()
as a public endpoint.
I know I could just create different api branches (/public
and /secure
, for example), but I’d like to avoid duplicated endpoints if possible.