Hi,
Probably, some of you already tried to do something similar but I wasn’t able to find any valuable response. The problem is:
There is a need to have multiple (currently 2) themes deployed in a Keycloak server instance, different themes are used by different Realms. Those themes are trying to change the default login theme behavior. I’m implementing LoginFormsProviderFactory in order to provide my own LoginFormsProvider that extends FreeMarkerLoginFormsProvider. But the problem is, that only 1 is visible to the Keycloak, the other one is ignored, unless, I uninstall one theme from Keycloak.
There is no possibility of having multiple implementations of LoginFormsProviderFactory (one per theme/jar) deployed at the same time in the Keycloak. It seems that Keycloak is specifically asking for getId() method from Factory to be exactly like this:
@Override
public String getId() {
return "freemarker";
}
If anything else, is returned, the Keycloak does not see it, the login page rendering fails and an error is thrown
ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-2) Uncaught server error: java.lang.NullPointerException: Cannot invoke "org.keycloak.forms.login.LoginFormsProvider.setAuthenticationSession(org.keycloak.sessions.AuthenticationSessionModel)" because the return value of "org.keycloak.models.KeycloakSession.getProvider(java.lang.Class)" is null
Does anyone have any idea how to overcome this problem?
I’m using Keycloak 21.0.2 at the moment.
Regards