Forum Stats

  • 3,813,998 Users
  • 2,258,806 Discussions
  • 7,892,481 Comments

Discussions

Validation eventhanlder in OIM 11G R1 11.1.1.5.4

Bhanuchandar Bobbili
Bhanuchandar Bobbili Member Posts: 210 Blue Ribbon
edited Jan 24, 2014 1:21PM in Identity Manager

Hi Experts,

I have a requirement to validate the data entered in the CREATE USER form of OIM Admin console.

example: I have a UDF called mobile number, when a HELPDESK team enters data in the UDF, OIM should immediately verify it's a number or not and throw error message saying the value entered is not unique.

Can I achieve this VALIDATION event handler? or is there any other way to achieve this?

OIM version: OIM R1 11.1.1.5.4

Thanks in Advance!!!

Tagged:
«1

Answers

  • Validation event handler works on submit button click. it will not throw error imideatly after entering the mobile number. if you want the validation on submit button click, u can achive that using validation handler

    Nirupam Samanta
  • Bhanuchandar Bobbili
    Bhanuchandar Bobbili Member Posts: 210 Blue Ribbon
    edited Jan 10, 2014 7:13AM

    Thanks for quick reply,

    There are only two buttons ( Save, Cancel) on create user form. Does the submit button mean SAVE button ??

    Can you provide any sample code for that??

    I tried using below code

    package project4_eventhandlers_localr1;

    import java.io.Serializable;

    import java.util.HashMap;

    import oracle.iam.platform.kernel.ValidationFailedException;

    import oracle.iam.platform.kernel.spi.ValidationHandler;

    import oracle.iam.platform.kernel.vo.BulkOrchestration;

    import oracle.iam.platform.kernel.vo.Orchestration;

    public class validationEventhandler implements ValidationHandler {

        public void initialize(HashMap<String, String> hashMap) {

        }

        public void validate(long l, long l1, Orchestration orchestration) {

            HashMap<String, Serializable> ParametersArray =

                orchestration.getParameters();

            String TestAttribute = (String)ParametersArray.get("USR_UDF_TESTATTRIBUTE");

        

                System.out.println("TestAttribute value" + TestAttribute);

                if (TestAttribute.contains("TEST")) {

                      throw new ValidationFailedException();

                    }

            }

        public void validate(long l, long l1,

                             BulkOrchestration bulkOrchestration) {

        }

    }


    EventHandlers.xml is as shown below


    <?xml version='1.0' encoding='utf-8'?>

    <eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel   orchestration-handlers.xsd">

    <!-- Custom validation event handlers -->

       <validation-handler

        class="project4_eventhandlers_localr1.validationEventhandler"

        entity-type="User"

        operation="CREATE"

        name="validationEventhandler"

        order="3012345"/>    

        <validation-handler

        class="project4_eventhandlers_localr1.validationEventhandler"

        entity-type="User"

        operation="MODIFY"

        name="validationEventhandler"

        order="3012346"/>

    </eventhandlers>

    Plug.xml is

    <?xml version="1.0" encoding="UTF-8"?>

    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">

        <plugin pluginclass= "project4_eventhandlers_localr1.validationEventhandler"

                version="1.0" name="validationEventhandler">

        </plugin>

      </plugins>

    </oimplugins>

    But when I create a user SAVE button I am receiving following error in DIAGNOSTIC LOG irrespective of data I give....


    and on the Create user form it shows a pop up message " A system error occurred "

    [2014-01-08T15:55:58.492-05:00] [oim_server1] [WARNING] [IAM-0080002] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: ca8fcc1ffe30f019:47e52517:1437032f4ca:-8000-0000000000000779,0] [APP: oim#11.1.1.3.0] Orchestration validation failed on the event handler - null

    [2014-01-08T15:55:58.548-05:00] [oim_server1] [ERROR] [IAM-3050029] [oracle.iam.identity.usermgmt.impl] [tid: [ACTIVE].ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: ca8fcc1ffe30f019:47e52517:1437032f4ca:-8000-0000000000000779,0] [APP: oim#11.1.1.3.0] The user cannot be created due to validation errors.[[

    oracle.iam.platform.kernel.ValidationFailedException: Orchestration validation failed on the event handler - validationEventhandler

            at oracle.iam.platform.kernel.impl.OrchProcessData.runValidationEvents(OrchProcessData.java:207)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.validate(OrchestrationEngineImpl.java:569)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.process(OrchestrationEngineImpl.java:433)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:381)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:334)

            at oracle.iam.identity.usermgmt.impl.UserManagerImpl.create(UserManagerImpl.java:653)

            at oracle.iam.identity.usermgmt.api.UserManagerEJB.createx(Unknown Source)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    ..........................

    .........................

    Caused by: java.lang.NullPointerException

            at project4_eventhandlers_localr1.validationEventhandler.validate(validationEventhandler.java:21)

            at oracle.iam.platform.kernel.impl.OrchProcessData.validate(OrchProcessData.java:217)

            at oracle.iam.platform.kernel.impl.OrchProcessData.runValidationEvents(OrchProcessData.java:180)

            ... 108 more

    Any Suggestions??????????????

    Thanks in advance...


  • yes submit means save button.
    your code is throwing  nullpointer exception. I suspect  the below statment is returing null.

    String TestAttribute = (String)ParametersArray.get("USR_UDF_TESTATTRIBUTE ");

    u should not use the data base column name here  (USR_UDF_TESTATTRIBUTE) . insteed of this u need to give the attribute name.

  • Bhanuchandar Bobbili
    Bhanuchandar Bobbili Member Posts: 210 Blue Ribbon

    Thanks for the quick reply.

    But in oracle link  http://docs.oracle.com/cd/E21764_01/doc.1111/e14309/oper.htm#CCHJHFGE  example is shown using column name usr_password!!!

    Example 1: Custom Password Validation

    Example 8-2 shows a sample custom validation handler code fragment that checks to ensure that $ is not used in a password.

    Example 8-2 Sample Custom Validation Handler

    throws ValidationException, ValidationFailedException { HashMap<String, Serializable> parameters = orchestration.getParameters(); String password = (parameters.get("usr_password") instanceof ContextAware) ? (String) ((ContextAware) parameters.get("usr_password")).getObjectValue() : (String) parameters.get("usr_password"); if (password.contains("$")) { throw new ValidationFailedException(); } }
  • VishwaK-Oracle
    VishwaK-Oracle Member Posts: 160 Employee

    #Export the user.xml file, modify usr_locked attribute tag required to false, for example.

    <attribute name="usr_locked">

    <type>string</type>

    <required>false</required>

    #Import user.xml back to MDS

    #Restart OIM.

    Now the System Property Account Status will be returned to non-required state.

    Let me know outcome ... Thnx

  • Bhanuchandar Bobbili
    Bhanuchandar Bobbili Member Posts: 210 Blue Ribbon

    Thanks for reply bro..

    But The recently export MDS file User.xml already contains

    <attribute name="usr_locked">

    <type>string</type>

    <required>false</required>

    <searchable>true</searchable>

  • please go to the link http://docs.oracle.com/cd/E14571_01/doc.1111/e14309/oper.htm

    check the example 7-2 Sample Custom Pre Process Event Handler , check how the middle name attribute has been retrieved from orchestration.

    Do one thing print the whole orchestration

    public void validate(long l, long l1, Orchestration orchestration) {

            HashMap<String, Serializable> ParametersArray =

                orchestration.getParameters();

    System.out.println("ParametersArray value" + ParametersArray );

            String TestAttribute = (String)ParametersArray.get("USR_UDF_TESTATTRIBUTE");

       

                System.out.println("TestAttribute value" + TestAttribute);

                if (TestAttribute.contains("TEST")) {

                      throw new ValidationFailedException();

                    }

            }

    and check the attribute name.

    Nirupam Samanta
  • Bhanuchandar Bobbili
    Bhanuchandar Bobbili Member Posts: 210 Blue Ribbon
    edited Jan 10, 2014 7:12AM

    Hi .. Now I can print the orchestration....

    I kept below line in code...

                if (firstName.contains("first")) {

                    throw new ValidationFailedException();

                }

    ....  But it shows "A system error occurred" but does show FIRSTNAME should not contain word "FRIST"...

    Log is shown below: Log throws exception at Line 45 which is the if block I pasted above.

    Log:

    The user cannot be created due to validation errors.[[

    oracle.iam.platform.kernel.ValidationFailedException

            at project4_eventhandlers_localr1.validationEventhandler.validate(validationEventhandler.java:45)

            at oracle.iam.platform.kernel.impl.OrchProcessData.validate(OrchProcessData.java:217)

            at oracle.iam.platform.kernel.impl.OrchProcessData.runValidationEvents(OrchProcessData.java:180)

    at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.validate(OrchestrationEngineImpl.java:569)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.process(OrchestrationEngineImpl.java:433)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:381)

            at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:334)

            at oracle.iam.identity.usermgmt.impl.UserManagerImpl.create(UserManagerImpl.java:653)

            at oracle.iam.identity.usermgmt.api.UserManagerEJB.createx(Unknown Source)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

  • VishwaK-Oracle
    VishwaK-Oracle Member Posts: 160 Employee

    1) Check the system property "XL.EmailValidationPattern" and modify it based on requirement.
    2) Ensure OIM Admin (i.e. xelsysadm) should have valid email id.
    3) Try to register a end user with valid email id and check that user is getting email or not.

    http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14316/unauth_selfservice.htm


    Hope this helpful!!

  • try this one..

    public void validate(long processId, long eventId,
       Orchestration orchestration) throws ValidationException,
       ValidationFailedException {

    String firstName= null;
      HashMap<String, Serializable> ParametersArray = orchestration.getParameters();

    System.out.println("ParametersArray value" + ParametersArray );

    String firstName= = (String)ParametersArray.get("First Name");

    System.out.println("firstName= " + firstName);

    if (your codition) {
    throw new ValidationFailedException(" sample validation error");
        }
    }

This discussion has been closed.