Skip to content

About

Key cloak OAuth authentication service for TDEI

Topics

Resources

Stars

0 stars

Watchers

5 watching

Forks

Repository files navigation

Keycloak

Keycloak serves as the central authentication and token management server for the TDEI project. It provides secure and efficient identity management, handling all aspects of user registration, authentication, and token management.

Create an Environment File (.env)

Create a file named .env in your project directory and add the required environment variables:

Environment Variable Value Description
KC_DB_URL jdbc:postgresql://your-db-host:5432/your-db-name Database connection URL
KC_DB_USERNAME your-db-username Database username
KC_DB_PASSWORD your-db-password Database password
KC_DB_SCHEMA keycloak Database schema for Keycloak
KC_HEALTH_ENABLED true Enables health check endpoints
KC_HTTP_MANAGEMENT_HEALTH_ENABLED false Expose /health on the main HTTP port (8080) instead of management port 9000
KC_HOSTNAME_STRICT false Disables strict hostname checks
KC_HOSTNAME https://your-keycloak-host Optional public hostname (recommended in production)
KC_HTTP_ENABLED true Enables HTTP support (required behind TLS-terminating proxy)
KC_PROXY_HEADERS forwarded or xforwarded Proxy headers to trust; must match what the reverse proxy sends
KC_BOOTSTRAP_ADMIN_USERNAME admin Initial Keycloak admin username (first start only)
KC_BOOTSTRAP_ADMIN_PASSWORD admin-password Initial Keycloak admin password (first start only)

Docker Build Command to Accept the .env File

Use the --env-file option when running the container:

Build the Docker Image

docker build -t keycloak-custom .

Run the Docker Container with the .env File

docker run --env-file .env -p 8080:8080 keycloak-custom

Alternative: Pass Environment Variables Manually

Instead of using a .env file, you can pass variables directly in the command:

docker run -e KC_DB_URL="jdbc:postgresql://your-db-host:5432/your-db-name"
-e KC_DB_USERNAME="your-db-username"
-e KC_DB_PASSWORD="your-db-password"
-e KC_BOOTSTRAP_ADMIN_USERNAME="admin"
-e KC_BOOTSTRAP_ADMIN_PASSWORD="admin-password"
-e KC_HTTP_ENABLED="true"
-e KC_PROXY_HEADERS="forwarded"
-p 8080:8080 keycloak-custom

Keycloak Portal Access

Once the container is running, access the Keycloak Admin Console at:

For new clients or installation ensure

  • user admin@tdei.com creds is reset for security and it is created with default password in config.
  • credential secrets are regenerted for each TDEI clients
  • Realm email SMTP password is set.

Custom Themes

The TDEI custom theme is copied to Keycloak’s themes directory

Realm Import

The TDEI realm configuration is imported on startup from tdei-realm.json

About

Key cloak OAuth authentication service for TDEI

Topics

Resources

Stars

0 stars

Watchers

5 watching

Forks

Contributors

Languages