Handing over JWT to OpenSearch in requests using Spring Data for OpenSearch

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch 3.2.0, Spring Boot 3.4.x

Describe the issue:

I have a Spring Boot application where users authenticate with JWT using Spring Security. I want to hand over this JWT in the Authorization header to OpenSearch for all OpenSearch requests made for the current user.

How can this be done? I know that I can use a request interceptor to add headers to OpenSearch requests, but the threads that do the requests come from a thread pool and do not have access to the SecurityContextHolder to get the JWT. How can I make the JWT available to the threads doing the OpenSearch calls?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.