Learning-keycloak

Keycloak: Open Source Identity and Access Management

Identity: Unique name of person or device
Authentication: Process of verifying identity
Authorization: Function over identity assigning access rights. Grant access based on a set of rules, where the rule depend on identity.

For more information: here

How to run the project:

docker-compose up --build

Authenticate the client:

  1. Create the realm to manage IAM for your application [Don't use master realm]
  2. Create the client
  3. Fill the valid redirect uris, valid post logout redirect uris, and web origins
Images to create client

telegram-cloud-photo-size-5-6332609719956520474-y

Image showing browser web origin

image

  1. Create a user and set the password
Image showing setting user password

telegram-cloud-photo-size-5-6332609719956520476-y

  1. Fill the .env file of frontend
  2. After following from step 1-4.
  3. Run the project
  4. You are able to login the user and see the protected route

Validate the token from the backend:

  1. Get the client public key:
Image showing pulic key

telegram-cloud-photo-size-5-6332609719956520476-y

  1. Add the public key in .env file of backend
  2. Run the project
  3. Now you are able to see the socials of the user if email matches in the data:
backend/routes/socials.js

let data = {
  "test@gmail.com": {
    github: "https://github.com/test",
    linkedin: "https://linkedin.com/in/test",
    twitter: "https://twitter.com/test",
    facebook: "https://facebook.com/test",
  },
  "best@gmail.com": {
    github: "https://github.com/best",
    linkedin: "https://linkedin.com/in/best",
    twitter: "https://twitter.com/best",
    facebook: "https://facebook.com/best",
  },
};

Thank you!