To enable integration for Gentics CMS add the following code to a file in to your /Node/etc/conf.d/
:
<?php /** * mapKeycloakGroups receives all user attributes and * has to return the ID of the user group in which * newly created users should reside * * @param $attributes array of user attributes * @retun array of groups for the user */ function mapKeycloakGroups($attributes) { return array(4); } $KEYCLOAK = array( // Fields from keycloak.json START 'authServerUrl' => 'http://YOUR_KEYCLOAK_INSTANCE:8081/auth', 'realm' => 'YOUR_REALM', 'clientId' => 'YOUR_CLIENT', 'clientSecret' => 'THE_CLIENT_SECRET', 'redirectUri' => 'http://YOUR_CMS_INSTANCE/.Node/?do=100', // Fields form keycloak.json END 'groupMapper' => 'mapKeycloakGroups' );
The group mapper function must return an array containing all group IDs a newly created user should be a member of.
If you are using the new UI, you will also have to make sure the REST-API is configured to use the Keycloak servlet filter.
Except for the groupMapper
entry, the configuration entries correspond exactly to the respective entries in the keycloak.json
you can generate in the Keycloak admin front-end, and you should put all the entries here even when they are not listed in the example above.