28 Nov 2013
 

Apache Syncope: add user or role pre-processing mechanism

Written by mdisabatino

Before storing/propagating/synchronizing a specific user or role, a pre-processor can be called in order to allow any kind of manipulation before any actual operation takes place.

To make this, you must implement an interface into Apache Syncope overlay in order to perform custom pre-processing operations.

For example, before an user is propagated or synchronized, the value of an given attribute must be transformed:

AO —> Administrative Office

GAO —> General Accounting Office

ISSO —> Information Systems Security Office

To do this, you must perform the following steps:

  1. Implementing a custom class for org.apache.syncope.core.rest.data.DefaultAttributableTransformer interface.
  2. Replace in restContext.xml this line:
    <bean id="attrTransformer" class="org.apache.syncope.core.rest.data.DefaultAttributableTransformer"/>
    
    with
    <bean id="attrTransformer" class="org.apache.syncope.core.rest.data.OUAttributableTransformer"/>
    

In your custom class you must implement this methods:

              @Override
              public  T transform(final T input) {
              //Code for attribute manipulation - create operation
              }

              @Override
              public  T transform(final T input) {
              //Code for attribute manipulation - update operation
              }

You can use a properties file, a database table or a particular algorithm for the manipulation of the value. You can do anything you want.

In my case, I preferred to use a database table, directly managed from the Apache Syncope console. I have implemented a custom panel under Configuration tab to manage translations and this is the result.

       

« Return