by Gaurav Singh
Tips, Tricks, and Technical Insight into Customizations for the Oracle Identity Manager User Interface
Customizing Oracle Identity Manager's (OIM) self-service console ("ID Console") fulfills a number of business requirements, including:
In this article, we will look at some behind-the-scenes details about how OIM (in sync with some other components) achieves this flexibility on UI. It is assumed here that the reader is familiar with the basic functionality of OIM and has knowledge of various application development framework artifacts, like EO.xml, VO.xml, pageDef.xml, tf.xml, .jsff files and managed beans (mBeans). This article applies to OIM 11gR2 and above.
Oracle Metadata Services (MDS) provides an upgrade-safe customization framework over XML files. Let's have a look at the example below to understand what that means:
Suppose an application provides the following OOTB XML document, with the path /metadata/sample-app-metadata.xmlmanaged by MDS.
<BaseDocument id="base">
<TagA id="tagA" name="Sample Tag A" prop="30" />
<TagB id="tagB" name="Sample Tag B" prop="25" />
<TagC id="tagC" name="Sample Tag C" prop="10" />
</BaseDocument>
Now, if the application guarantees that this XML can be customized at runtime, it will provide two strings for that. A customization layer name ("site" in the case of OIM) and a layer value ("site" again for OIM). Using this, a customization XML file can be created in directory /metadata/mdssys/cust/<layer-name>/<layer-value>/sample-app-metadata.xml.xml (note the ".xml.xml" extension), as follows:
<mds:customization version="11.1.1.61.15" xmlns:mds="http://xmlns.oracle.com/mds">
<mds:modify element="tagB">
<!-MODIFYING PROP OF TAG-B TO 15 -->
<mds:attribute name="prop" value="15"/>
</mds:modify>
<mds:insert parent="base" position="first">
<!-INSERTING A CUSTOM ELEMENT AT THE BEGINNING OF ROOT TAG -->
<Tag0 id="tag0" name="Custom Tag 0" prop="35" />
</mds:insert>
</mds:customization>
At runtime, when the application now asks for sample-app-metadata.xml, the following XML will come into effect (custom changes are in bold):
<BaseDocument id="base?>
<Tag0 id="tag0" name="Custom Tag 0" prop="35" />
<TagA id="tagA" name="Sample Tag A" prop="30" />
<TagB id="tagB" name="Sample Tag B" prop="15" />
<TagC id="tagC" name="Sample Tag C" prop="10" />
</BaseDocument>
Now, since the customization XML is existing independently on its own, replacing the base document while upgrading to the next version will not affect the customizations. It is upgrade-safe.
OIM uses this concept, along with sandboxing from MDS, for UI customizations. Let's walk through a typical use case of adding a custom attribute to the user entity and dropping it onto create and view user pages. Side by side, we will see the artifacts being generated and their significance.
Figure 1: Adding a new attribute
Figure 2: Inside the sandbox
<?xml version='1.0' encoding='UTF-8'?>
<mds:customization version="11.1.1.64.93" xmlns:mds="http://xmlns.oracle.com/mds"
motype_local_name="PDefEntityObject" motype_nsuri="http://xmlns.oracle.com/bc4j">
<!-- INSERT STATEMENT TO BE EXECUTED OVER OOTB USEREO.XML FILE-->
<mds:insert parent="UserEO" position="last">
<!-- EO.XML ENTRY FOR ATTRIBUTE. NOTE THAT NAME IS ppNumber__c. -->
<Attribute Name="ppNumber__c" IsPersistent="false" Precision="60" Scale="0"
ColumnName="PPNUMBER__C" Type="java.lang.String" ColumnType="VARCHAR2(255)"
SQLType="VARCHAR" xmlns="http://xmlns.oracle.com/bc4j">
<Properties>
<!-- CERTAIN PROPERTIES OF ATTRIBUTE -->
<Property Name="AttributeType" Value="Text"/>
<Property Name="DISPLAYWIDTH" Value="60"/>
<Property Name="ExtnCustom" Value="Y"/>
<!-- REFERENCE TO BizEditorBundle.xlf FOR DISPLAY LABEL (CONTAINED IN THE SAME SANDBOX) -->
<Property Name="LABEL_ResId"
Value="${adfBundle['oracle.adf.businesseditor.model.util.BaseRuntimeResourceBundle']
['oracle.iam.ui.common.model.user.entity.UserEO.ppNumber__c_LABEL']}"/>
<!-- NAME OF ATTRIBUTE AS KNOWN BY OIM BACKEND -->
<Property Name="oimRefAttrName" Value="ppNumber"/>
</Properties>
<CompOper Name="=" ToDo="2" Oper="=" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="STARTSWITH" ToDo="2" Oper="STARTSWITH" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="ENDSWITH" ToDo="2" Oper="ENDSWITH" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="<>" ToDo="2" Oper="<>" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="CONTAINS" ToDo="2" Oper="CONTAINS" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="DOESNOTCONTAIN" ToDo="2" Oper="DOESNOTCONTAIN" MinCardinality="1"
MaxCardinality="1"/>
<CompOper Name="Dummy" ToDo="-2" Oper="Dummy" MinCardinality="1" MaxCardinality="1"/>
</Attribute>
</mds:insert>
<mds:modify element="UserEO">
<mds:attribute name="StaticDef" value="oracle.iam.ui.common.model.user.entity.UserEO"/>
</mds:modify>
</mds:customization>
Figure 3: User Create Screen (Data Component Catalog - userVO)
Figure 4: User Details Screen (Data Component Manage Users - UserVO1)
Figure 5: userCreateForm.jsff.xml
Figure 6: userCreateFormPageDef.xml.xml
Let's take a look at some components that are consumed by OIM for customizing the UI through MDS.
Figure 7: OIM Sandbox Lifecycle
Apart from MDS-based customization framework, OIM provides a way to build custom ADF task flows and managed beans. These are generally used for custom validations, handling the action of custom links and buttons, or even building completely new screens and launching them through certain links. Here is the deployment process for such changes:
Create ADF Model and ADF View Controller projects in the jdev containing your artifacts. OIM Client, OIM Model and OIM View Controller shared libraries must be included in your custom projects. These libraries can be found in the IDM_HOME/server/jdev.lib directory.
Prepare ADF Library JAR files from the jdev projects. An ADF Library JAR deployment profile needs to be created in jdev to prepare these jars.
Package the ADF Library JAR files into oracle.iam.ui.custom-dev-starter-pack.war (file present in IDM_HOME/server/apps) inside WEB-INF/lib folder. Create a lib folder if not present OOTB inside WEB-INF.
Locate the oracle.iam.ui.custom library in the WebLogic console to see the deployment path (which might not be deployed from IDM_HOME/server/apps).
Figure 8: oracle.iam.ui.custom Library in the WebLogic Console
Replace that web archive (war) in the file system with the one you have newly repackaged.
Stop the two active applications shown Figure 8. These are ID console and sysadmin console applications, respectively, and have a dependency over custom library.
Update the oracle.iam.ui.custom library deployment. Once the update is complete, start the two applications stopped previously.
A few points must be kept in mind when developing custom mBeans:
This article provides technical insight into the possible customizations over OIM UI, and walks through the most common use case—adding a new user attribute to the create and view details pages—and describes what happens behind the scenes. It also provides the basic steps that must be performed to inject into OIM UI custom ADF code that is available at runtime.
Gaurav Singh is part of the Oracle Identity Manager Developers' group. Since the very beginning of his career he has been interested in UI technologies and has been exploring Oracle ADF, Oracle Metadata Services, Oracle Composer, and similar tools to deliver next-generation user interfaces.