Created
January 30, 2024 06:21
-
-
Save Kasun002/31ab9fe8e3d8709d6790aaa1357305b9 to your computer and use it in GitHub Desktop.
Configure Keycloak with PG SQL for role based authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
volumes: | |
postgres_data: | |
driver: local | |
services: | |
postgres: | |
image: postgres:14.1 | |
container_name: keycloak-nodejs-example-postgres | |
volumes: | |
- postgres_data:/var/lib/postgresql/data | |
environment: | |
POSTGRES_PASSWORD: root | |
POSTGRES_DB: keycloak | |
POSTGRES_USER: keycloak | |
keycloak: | |
image: jboss/keycloak:15.0.2 | |
container_name: keycloak-nodejs-example-keycloak | |
environment: | |
DB_VENDOR: POSTGRES | |
DB_ADDR: postgres | |
DB_DATABASE: keycloak | |
DB_USER: keycloak | |
DB_PASSWORD: root | |
KEYCLOAK_USER: admin | |
KEYCLOAK_PASSWORD: admin | |
command: | |
- "-Dkeycloak.profile.feature.upload_scripts=enabled" | |
- "-Dkeycloak.migration.action=import" | |
- "-Dkeycloak.migration.provider=dir" | |
- "-Dkeycloak.migration.dir=/opt/jboss/keycloak/import" | |
- "-Dkeycloak.migration.strategy=OVERWRITE_EXISTING" | |
ports: | |
- 8080:8080 | |
volumes: | |
- "./docker/import_realm_users:/opt/jboss/keycloak/import" | |
depends_on: | |
- postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Role-Based Authentication System
This project implements a role-based authentication system using Node.js, Keycloak, and PostgreSQL.
Steps to Implement
1. Setup PostgreSQL Database
users
androles
tables2. Setup Keycloak
3. Setup Node.js Application
express
,keycloak-connect
,pg
)4. Integrate Keycloak with Node.js
keycloak-connect
middleware in your Node.js application5. Implement Role-Based Access Control (RBAC)