I'm trying to authenticate one microservice request in another microservice, but I'm failing to find any examples showing how to configure the client in keycloak and how to configure spring security. This is the architecture I'm trying to archive:
I have already managed to get user authorization working and secure microservice A, and now i'm trying to authorize requests from microservice B, but i'm not sure how to do it, whether should I create a dedicated user in keycloak for microservice B, or client in realm, or some other technical account? Is it done by some api key or should Microservice B request access token in the similar way the user does?
My idea is to create a client in Keycloak for microservice B, request an access token from Keycloak and attach it to every request sent to microservice A.
Is this the correct approach?
Is there some library addressing this case?
I could not find any example of such communication with spring, are you aware of any repositories with such example?
