[keycloak-user] JTA and UserStorageProvider implementations

Ilya Korol llivezking at gmail.com
Wed Nov 7 21:40:56 EST 2018


Hi. I'm trying to realize how should i configure our datasources from 
JTA point of view. As far as i know default settings (that also 
described in docs) don't include any JTA capabilities, so keycloak will 
work in local transactions mode. (There is also a thing that confused me 
a little: in Wildfly Admin Console all datasources have 'JTA' option 
enabled by default). So the question is: what settings should i use if i 
add UserStorageProvider implementation which uses separate DataSource. 
As far as i understand JTA should be enabled for such case, so how 
should i configure datasources. For example:

- KeycloakDS [Oracle] - datasource for keycloak itself

- ExternalDS [Oracle] - datasource for external user storage

Should both datasource be XA and JTA capable? And what about 
EntityManager that i would use for user data extraction? I refer to 
example implementation of User Storage Provider from documentation:|
|

|@Stateful||@Local(EjbExampleUserStorageProvider.class)||public class EjbExampleUserStorageProvider implements UserStorageProvider,||        UserLookupProvider, UserRegistrationProvider, 
UserQueryProvider, CredentialInputUpdater, CredentialInputValidator, 
OnUserCache { @PersistenceContext protected EntityManager em; protected 
ComponentModel model; protected KeycloakSession session; public void 
setModel(ComponentModel model) { this.model = model; } public void 
setSession(KeycloakSession session) { this.session = session; } @Remove 
@Override public void close() {} }|

||

||

|Does transaction context of this entity manager same as transaction 
context of Keycloak Session? |



More information about the keycloak-user mailing list