#StackBounty: #spring #spring-boot #docker #oauth-2.0 #keycloak Keycloak and Spring Boot web app in dockerized environment

Bounty: 100

Consider the following environment:

  • one docker container is keycloak
  • another docker container is our web app that uses keycloak for authentication

The web app is a Spring Boot application with “keycloak-spring-boot-starter” applied. In application.properties:

keycloak.auth-server-url = http://localhost:8028/auth

A user accessing our web app will be redirected to keycloak using the URL for the exposed port of the keycloak docker container. Login is done without problems in keycloak and the user (browser) is redirected to our web app again. Now, the authorization code needs to be exchanged for an access token. Hence, our web app (keycloak client) tries to connect to the same host and port configured in keycloak.auth-server-url. But this is a problem because the web app resides in a docker container and not on the host machine, so it should rather access http://keycloak:8080 or something where keycloak is the linked keycloak docker container.

So the question is: How can I configure the keycloak client to apply different URLs for browser redirection and access token endpoints?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.