Skip to content
Advertisement

Is there a way to configure the storageProviderTimeout in Keycloak?

I have developed an implementation of the User Storage SPI that calls an API in a legacy system to migrate users. I need to configure my own value for storageProviderTimeout as there is a remote chance that it will take longer than the default 3 seconds to get a response. I have already configured the socket-timeout-millis to be more than the default 5 seconds before timing out, but this does not help as the storageProviderTimeout has a default of 3 seconds. Upon looking at the Keycloak source code, specifically AbstractStorageManager.java there is a mention of this value being configurable:

JavaScript

The function to read the configured value looks like this:

JavaScript

When the UserStorageManager instance is created (which extends AbstractUserManager the constructor instantiates the superclass with this code:

JavaScript

where "user" is what later gets passed to Config.scope() in the getStorageProviderTimeout() function.

What I’ve tried so far is manually adding the tag <user> in standalone-ha.xml at the same level as the <theme> tag, like this:

JavaScript

but upon booting Keycloak, I get this error:

JavaScript

I hope someone can shed some light on this for me as it feels like I’m missing something obvious. Thanks in advance!

Advertisement

Answer

As discussed here https://keycloak.discourse.group/t/how-to-configure-storageprovidertimeout/9171, there are currently no possibilties to configure this property.

There is an open issue to address this problem: https://issues.redhat.com/browse/KEYCLOAK-18856

As a temporarily quick and dirty workaround you can set the value at runtime via reflections in e.g. your custom UserStorageProvier implementation:

JavaScript

}

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement