Pradeep
Pradeep

Reputation: 131

Change user DB connection at runtime in Keycloak user storage SPI

We have a single Keycloak realm configured to be used from a different server for authentication. I am implementing Keycloak user storage API to look up from user database. Each server can have a different user database.

I can determine the database to connect based on request details but not sure how can I get the same in user storage API.

Update:

I can also do with identifying client ID.

Another option can be to let the SPI implementation invoke a REST API to validate credentials to simplify keycloak configuration. However this would also need some identifier to determine database.

Please advise.

Upvotes: 0

Views: 371

Answers (1)

Pradeep
Pradeep

Reputation: 131

Keycloak does not provide request URL to user storage SPI implementation. It does provide realm and client IDs. If required, realm or client values can be used to determine required action.

Upvotes: 0

Related Questions