I've recently configured SSO with Keycloak servlet adapter.
The problem is that we have service-to-service communication, which goes with BASIC authentication.
Previously, we were using JAAS authentication, therefore the S2S communication was stateless (no sessions associated).
With the SSO/Keycloak, this is no longer the case. Moreover, each REST request, creates a new Keycloak session.
I tried to find a configuration or an alternative solution without Keycloak customization and coding, but I couldn't.
P.S. Due to backward compatibility, I can't change the REST clients to switch to BEARER or other auth methods.
Anyone having better idea?
I read the point that you cannot change from basic to bearer. But can you switch off your basic authentication altogether from your rest services?
I am saying that because after doing that you may be able to move your authentication logic to a filter.
You can create a Filter that would intercept all requests before they would even reach your Rest Service. This filter handles authentication and based on success proceeds to rest service otherwise returns 401. Sample code:
Try thinking along these lines, you may get some direction.