Skip to content

A spring cloud api gateway secured with keycloak having multiple oidc clients

Notifications You must be signed in to change notification settings

ubaid4j/api-gateway-with-multiple-oidc-clients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a simple cloud api gateway that is secured with OAuth2+OIDC having multiple OIDC clients to login.

Requirements

  1. Docker, version >= 24.0.2

How to run

  1. Run docker compose -f src/main/docker/compose.yaml up
  2. And navigate to http://localhost:32900
  3. You will see following links to login in multiple customers realm (credentials are provided)
    img.png
  4. Click on any link and provide the credentials (in following screenshot, I clicked on customer3 login link) img_1.png
  5. Expected output (OIDC user) img_2.png

Note:

After KeyCloak 21 (see issue), curl command is no longer working. So, for health check, we are using custom script.

See: health-check by this stackoverflow answer and compose.yaml that is using this script.

We have two services (keycloak and edge-service) in docker-compose. This application (edge-service) has graalvm native image that starts within seconds while keycloak takes 6-30 seconds to start, So this application have to wait 6-30 seconds for KC as it needs to register oidc clients during startup. As we cannot use curl command in KC container, so we are using custom script in keycloak service health check as mentioned above.

Another Note:

  • Add 127.0.0.1 keycloak entry in /etc/hosts file.

About

A spring cloud api gateway secured with keycloak having multiple oidc clients

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages