tipikae
tipikae

Reputation: 33

Thymeleaf + Gateway + Keycloak: best configuration

My project is:

architecture

I want to secure frontend and backend access with Keycloak:

I have tried multiple configurations for securing the frontend (Spring security, keycloak adapter) and the backend (oauth2-client, Spring security, authorization_code, password) with multiple keycloak clients configuration (public, confidential, bearer-only) and none of them succeeded entirely.

Either the frontend and the microservices are secured and not the gateway, either the gateway and the microservices are secured and not the frontend.

I have found a lot of tutorials but nothing like the architecture I want.

How would you configure the frontend, the gateway and keycloak ?

Upvotes: 0

Views: 1088

Answers (1)

tipikae
tipikae

Reputation: 33

Finally, I found the right configuration for my case:

  • microservices as oauth-resource-server,
  • Gateway as oauth-resource-server too,
  • Keycloak client with a public access-type,
  • Frontend application: two options:
    • Spring security alone and Keycloak endpoints for login and logout,
    • Or Spring security with Keycloak adapter.

The frontend only needs username and password. Keycloak returns a token. The gateway needs a valid token. The token is passed to microservices.

It’s one solution among others…

Upvotes: 1

Related Questions