Hi Keycloak community,
I’m working on an application where I’m integrating Keycloak with a custom User Storage Provider. My application uses PostgreSQL as the database, and I have the following setup:
- Keycloak Connection: Managed through
persistence.xmland used by Keycloak’s storage SPI. - Spring Data JPA Connection: Managed through Spring Boot’s
application.ymlfor my application’s REST API services.
Both connections point to the same PostgreSQL database, but they are managed separately to avoid potential issues with asynchronous data racing.
My questions are:
- Is this approach of using two separate connections (one for Keycloak and one for Spring Data JPA) valid and considered best practice when integrating with Keycloak?
- Are there any potential pitfalls or challenges I should be aware of when using this setup, particularly regarding transaction management and data consistency?
- Can I safely extend my repositories via
JpaRepositoryin this scenario, or should I consider a different approach for interacting with the database? - Are there alternative strategies that the community would recommend to ensure smooth integration and operation without compromising on performance or data integrity?
I’m keen to get insights or suggestions from those who have tackled similar challenges.
Thanks in advance for your guidance!