Sunday, August 30, 2015

Custom Error Message for Validation Handler

Tested On: Oracle Identity Manager 11.1.2.3.0
Description: Demonstrates how to create custom error messages or use out of the box error messages in a validation event handler.



Adding Custom Message to Logging.properties
1.Determine the path of your OIM application deployed on WebLogic.

Deployments > oim (11.1.2.0.0)

2. Locate the OIMServer.jar that is inside the OIM application directory. In this example, the OIMServer.jar can be found in "$MW_HOME/Oracle_IDM1/server/apps/oim.ear/APP-INF/lib" directory.

3. Make a backup of the OIMServer.jar and move it outside the OIM application directory.

4. Extract the OIMServer.jar file using "jar -xf OIMServer.jar" command. Modify the Logging.properties file that pertains to your use case. For example if you would like a custom error message when validating modification of a user, modify logging.properties and logging_en.properties (for English locale) located in "oracle/iam/identity/resources" directory.

Logging Property File

Note:  Your custom error code and message must be in proper format. An example is given below.

UIAM-1058201 = Custom error message.
UIAM-1058202 = Custom error message. Current user last name {0} and organization {1}.

#{0} and {1} are arguments you must supply when you are calling the OIM UserManagerUtils.createValidationFailedException.

// Example 
UserManagerUtils.createValidationFailedException("UIAM-1058202")
UserManagerUtils.createValidationFailedException("UIAM-1058202", new Object[]{lastName, organization});

5. After modifying the logging files, repackage the OIMServer.jar with th following command "jar -cf OIMServer.jar com/ META-INF/ oracle/ Thor/". Then replace the OIMServer.jar in the OIM application path with the modified one.

6. Restart the OIM managed servers.

Validation Event Handler Example

2 comments: