Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (51 loc) · 2.49 KB

keycloak-client-configuration.md

File metadata and controls

70 lines (51 loc) · 2.49 KB

Setup for keycloak

Architecture of Keycloak Hasura Connector

Arch

Setup the keycloak

Installation of keycloak

Configure keycloak for the connector

You need to configure two clients in keycloak. One is for frontend(React, Angular, Svelte) and other for the Hasura engine.

Create client for the frontend.

You need to create new public client in keycloak

  • Login to keycloak admin. Keycloak admin url http://KEYCLOAK_URL/auth/admin
  • Go to client Client
  • Click on Create Add Client
    • Client ID Any unique client id you want
    • Protocol openid-connect
    • Root URL Root url of the application. Now we are using the http://localhost:4200
  • Click on save Client config

Create client for backend

Now we will create backend for the hasura connector. It will require to verify the JWT token Obtained from the keycloak.

  • Login to keycloak admin. Keycloak admin url http://KEYCLOAK_URL/auth/admin
  • Go to client Client
  • Click on Create Backend App config
  • Click on save keycloak-connector-config.png
  • Select the Access Type to bearer only and client on Save Keycloak public type config
  • Copy the Secret from Credentials backend-secret.png

Optional step for the X-Hasura-Group-Id

X-Hasura-Group-Id Obtained by the group of the user. If user is added into group called as group1 then user organization id will be group1 , and for nested groups /group1/subgroup the X-Hasura-Group-Id is group1. To access the user group in token we need to add the scope for it so let get started

Following steps may vary for various keycloak version

  • Go to the Client scopes

  • Click on create Client scopes

  • Click on Next Client scope

  • Enter name groups

  • Click on save Step 2

  • Goto mappers

  • Click on create Step 3

  • Name: groups MapperType: Group Membership Token claim name group Step 4

Congratulations! You have configured you keycloak for the hasura connector

Configure keycloak with hasura connector