07-01-2019 01:12 AM
I wanted to point nuxeo to keycloak's backend db which is PostgreSQL for user/group directory For this I defined below extensions
<?xml version="1.0"?>
<component name="postgre.keycloak.datasource.config" version = "1.0">
<require>org.nuxeo.runtime.datasource.server.contrib</require>
<extension target="org.nuxeo.runtime.datasource"
point="datasources">
<datasource name="jdbc/testdb"
driverClassName="org.postgresql.Driver"
maxPoolSize="20" minPoolSize="5" blockingTimeoutMillis="10000">
<property name="url">jdbc:postgresql://<host>:<port>/testdb
</property>
<property name="username">user</property>
<property name="password">*****</property>
</datasource>
</extension>
</component>
<?xml version="1.0"?>
<component name="custom.directory.sql.config" version = "1.0">
<require>org.nuxeo.ecm.directory.sql.SQLDirectoryFactory</require>
<require>postgre.keycloak.datasource.config</require>
<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory" point="directories">
<directory name="demoUserSQLDirectory">
<schema>user</schema>
<dataSource>testdb</dataSource>
<table>keycloak_user</table>
<idField>username</idField>
<autoincrementIdField>false</autoincrementIdField>
<dataFile></dataFile>
<createTablePolicy>never</createTablePolicy>
<querySizeLimit>15</querySizeLimit>
<references>
<inverseReference directory="demoGroupSQLDirectory" dualReferenceField="members" field="groups"/>
</references>
</directory>
<directory name="demoGroupSQLDirectory">
<schema>group</schema>
<dataSource>testdb</dataSource>
<table>keycloak_group</table>
<idField>groupname</idField>
<dataFile></dataFile>
<createTablePolicy>never</createTablePolicy>
<autoincrementIdField>false</autoincrementIdField>
<references>
<tableReference dataFile="" directory="demoUserSQLDirectory" field="members" schema="user2group" sourceColumn="groupId" table="keycloak_user_group" targetColumn="userId"/>
<!--<tableReference directory="demoGroupSQLDirectory" field="subGroups" schema="group2group" sourceColumn="child_role" table="composite_role" targetColumn="composite"/><inverseReference directory="demoGroupSQLDirectory" dualReferenceField="subGroups" field="parentGroups"/> -->
</references>
</directory>
</extension>
<extension target="org.nuxeo.ecm.platform.usermanager.UserService" point="userManager">
<userManager>
<users>
<directory>demoUserSQLDirectory</directory>
</users>
<groups>
<directory>demoGroupSQLDirectory</directory>
</groups>
<defaultAdministratorId>administrator</defaultAdministratorId>
<defaultGroup>custom_group</defaultGroup>
</userManager>
</extension>
</component>
Can any please suggest how I handle the above scenario where schema of user/group differs in nuxeo and database tables?
P.S.
<fieldMapping>
<fieldMapping name="username">cn</fieldMapping>
Such tag is not supported in SQLDirectoryDescriptor<users>
<directory>demoUserSQLDirectory</directory>
</users>
<groups>
<directory>demoGroupSQLDirectory</directory>
</groups>
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.