Organization/User One-To-Many relationship definition problem

Hello guys,

I am developing an application with FastAPI and I use Keycloak as an IAM.

I have connected Keycloak with my PostgreSQL database and when the apps starts Keycloak creates a user_entity table where as I understand the schema is standard and the user attributes are specific.

Now I have another table I call Organization which I have created from my application and I want to implement the One Organization has Many Users with a foreign key on User table. Is there another way to do this since it is not a good practice to change the User table that Keycloak creates?

I think you misunderstand how OIDC/SAML authentication are ment to work. Your app and keycloak should not share their user db directly in most cases. Instead have an application user db and a keycloak user db and fill the application db from the OIDC/SAML claims in the tokens/assertions.

1 Like