User/groups/memberships management in GateIn is handled by OrganizationService API described here https://docs.jboss.org/author/display/GTNPORTAL36/Organization+API . This API supports listeners, which you can register into eXo kernel and then you will be able to listen to some events around object modification. In your case you can:
- Create subclass of class org.exoplatform.services.organization.UserEventListener and register it into kernel. Then GateIn portal will always trigger methods preSave/postSave of your listener before/after each creation or update of user.
- Create subclass of class org.exoplatform.services.organization.UserProfileEventListener and register it into kernel. Then GateIn portal will always trigger methods preSave/postSave of your listener before/after each creation or update of user profile.
For example see here https://github.com/gatein/gatein-portal/blob/master/component/web/oauth-common/src/main/java/org/gatein/security/oauth/data/UniqueOAuthProviderUsernameListener.java the example of UserProfileEventListener with overriden method preSave (triggered always before creation/edit of user profile)
And see GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/sso/oauth-configuration.xml (lines 117-124) on how this listener could be registered. You will probably need to add the class with your listener into GATEIN_HOME/modules/org/gatein/lib/main