To create custom code to run on the server after the user has been authenticated, you can create a custom processor and add it to the processors list for the externalUserProcessors property of the externalDataSynchronizer bean. To create a custom processor, extend the AbstractExternalSetupProcessor or MTAbstractExternalProcessor class, which provides access to all of the JasperReports Server service classes, such as the repository and user management. For example, to create a folder, you must use HibernateRepositoryService and ObjectPermissionService. See the description of Java APIs in the chapter “JasperReports Server APIs” in the JasperReports Server Ultimate Guide for more information on the available JasperReports Server services.
The processors for user setup and tenant mapping in the sample configuration files, such as externalUserProcessors or ldapExternalTenantProcessor, are themselves examples of processor implementation. These processors are described in detail in the sections for each authentication mechanism, for example, Mapping to Multiple Organizations.
In addition, many of the sample application context files include an externalUserFolderProcessor bean that calls code to automatically create a user home folder for the authenticated user. The following example shows how to add externalUserFolderProcessor to the externalUserProcessors property of the ExternalDataSynchronizer bean:
<bean id="externalDataSynchronizer"[/code] class="com.jaspersoft.jasperserver.api.security.externalAuth.ExternalDataSynchronizerImpl">[/code] <property name="externalUserProcessors">[/code] <list>[/code] <ref local="externalUserSetupProcessor"/>[/code] <ref local="externalUserFolderProcessor"/>[/code] </list>[/code] </property>[/code] </bean>[/code] |
The following code block shows how you might configure an externalUserFolderProcessor bean in your applicationContext-externalAuth-xxx.xml configuration file:
<bean id="externalUserFolderProcessor"[/code] class="com.jaspersoft.jasperserver.api.security.externalAuth.processors.[/code] ExternalUserFolderProcessor"[/code] parent="abstractExternalProcessor">[/code] <property name="repositoryService" ref="${bean.unsecureRepositoryService}"/>[/code] </bean>[/code] |
To write a processor, extend AbstractExternalUserProcessor and overwrite the process method with your java code. This gives you access to the following services:
| • | ProfileAttributeService |
| • | ObjectPermissionService |
If you extend MTAbstractExternalProcessor, you can access the following service:
Recommended Comments
There are no comments to display.