<div dir="ltr"><div><div><div><div>Hi,<br><br></div>in order to import users having encrypted passwords from existing user storage <em></em>I&#39;m implementing user federation provider based on the keycloak example <b><em>keycloak-examples-1.5.0.Final/providers/federation-provider</em></b><em>.<br></em></div>Additionally I considered hints<em> </em>provided by Scott Rossillo in the keycloak-user Digest, Vol 22, Issue 18<br></div><div>Above example works properly when retrieving users from a properties file. The next step in the implementation would be access to the database where users data is stored.<br> <br></div><b>My question: </b>What would be the best practice for accessing database from a custom keycloak provider?<br><br></div>Something like this?<br><br>// KeycloakSession<br>session.getProvider(JpaConnectionProvider.class, &quot;myTS&quot;)<br>                .getEntityManager()<br>                .createQuery(&quot;SELECT... ?<br><div><div><div><div><em><br><br></em></div><div><em><b>keycloak-server.json:</b><br>&quot;connectionsJpa&quot;: {<br>        &quot;default&quot;: {<br>            &quot;dataSource&quot;: &quot;java:jboss/datasources/KeycloakDS&quot;,<br>            &quot;databaseSchema&quot;: &quot;update&quot;<br>        },<br></em>      <em><em>&quot;myTS&quot;: {<br>            &quot;dataSource&quot;: &quot;java:jboss/datasources/myTsDS&quot;<br>        }</em>    }<br><br></em>Thank you,<em><br></em></div><div><em><br></em>Valerij Timofeev<br>Software Engineer<br></div><div>Trusted Shops GmbH<br><br></div><div><br></div></div></div></div></div>