Integrate with legacy system

Hi everyone, I wish to ask for your advice regarding the system integration I’m aiming to.

I have a legacy monolithic Java application which has a built-in authentication module (the classic LDAP query) and I wish to gradually decompose it into multiple modules, each one working in a SSO toward Keycloak.
I already have the first module decomposed, rewritten with Spring and integrated with Keycloak via the adapter.
I now need to integrate the legacy application to perform a silent login before redirecting the user to the application.
I managed to perform this silent login submitting a POST (very crude approach I admit, but the Authz Client library doesn’t seem to play nicely on me) to the protocol/openid-connect/token URL which returns me a valid token for the user: I know I will eventually have to refresh the token.

Now I’m wondering how should I use this token… I believe the solution should be to programmatically create the KEYCLOAK_ADAPTER_STATE cookie and push it onto the client, so that when the user jumps onto the new app, the Spring Adapter can use the cookie to login…

If my reasoning and approach is correct (which I doubt) I’m seeking help on how can I produce the cookie value having the token…

Ok, am I not getting any reply because what I’m doing is totally wrong or just because there is none interested into providing help? I’m wondering…

Have you imported the LDAP users into keycloak using the User Federation?

Now you will need to decide on a flow, maybe look at the resource owner password credentials grant

Oops, it look like resource owner credential grants do not support SSO