Customizing Oracle Identity Governance: Populating Request Attributes Page 1 of 29
Customizing Oracle Identity Governance : Populating Request Attributes Overview When creating requests for application instances using the Identity Self Service console, the form associated with the application instance must be completed. A common requirement is to have the fields in the form be pre-populated based on the user profile of the beneficiary of the request. This tutorial explains how to: create a managed bean in JDeveloper deploy the managed bean to Oracle Identity Governance customize the Identity Self-Service console to add a "Prepopulate" button test the customization Pre-requisites Before starting this tutorial, you should: Have completed the tutorial titled "Customizing Oracle Identity Governance: Configuring JDeveloper". o As a result you would have created an ADF ViewController project in JDeveloper o The name of the project in this example is PrePopulateMBean. The project has the default package com.example.ui.prepop.view. o Note: To save you time, the JDeveloper project for this tutorial is in the file UICustomization.zip. Have installed the Generic LDAP connector on the Oracle Identity Governance system Have created an application instance called "OUD on localhost" in the Oracle Identity Governance system for provisioning users to an Oracle Unified Directory Server. The request form for the application instance is called OUDFrm01 Page 2 of 29
Step 1: Creating the managed bean in JDeveloper 1. Create a Java class com.example.ui.prepop.view.prepopulatembean. To do this: a. In the Application pane, select the PrePopulateMBean project. b. Right-click on the project name, and select New. c. In the Categories pane, select General > Java. In the Items pane, select Java Class, and click OK. Page 3 of 29
d. In the Create Java Class dialog, enter PrePopulateMBean in the Name field, and click OK. e. Add the code for the PrePopulateMBean class. For your convenience, the code for the class is contained in the UICustomization.zip file. Here are some of the important methods in the class: getuser(): This method uses the OIM client APIs to retrieve the user profile information for a particular user. Page 4 of 29
actionlistener(): In Step 3 of this tutorial, this method is attached to the actionlistener ADF property of the Prepopulate button on the request form. As a result, this method is called when the Prepopulate button on the form is clicked. When called, it uses the RequestFormContext API to retrieve information about the current request. In particular, it retrieves information about the beneficiary of the request (the user the request is being created for). Next, the user key of the beneficiary is passed to the getuser() method to retrieve the first name and last name of the beneficiary. The FacesUtil helper class is then called to update the "First Name" and "Last Name" fields on the form. The names of the fields are defined in the request form created when the application instance is created. To view the names of the fields, open the request form in Web Composer (detailed in Step 3 of this tutorial) and view the properties for each field. isprepopulatebuttonrendered(): Page 5 of 29
This method uses the RequestFormContext API to check if the ActionType of the form is of a request, and that there is only a single beneficiary for the request. If so, it returns true. When customizing the form using Web Composer in Step 3 of this tutorial, the Disabled property of the button is attached to this method. If the method returns true, the button is not rendered. 2. Create a Java class com.example.ui.util.facesutil. To do this: a. In the Application pane, select the PrePopulateMBean project. b. Right-click on the project name, and select New. c. In the Categories pane, select General > Java. In the Items pane, select Java Class, and click OK. d. In the Create Java Class dialog, enter FacesUtil in the Name field, enter com.example.ui.util in the Package field, and click OK. e. Add the code for the FacesUtil class. Note: The code for the class is contained in the UICustomization.zip file. 3. Add the ADF Model Runtime and Resource Bundle libraries to the project properties. To do this: a. In the Application pane, right-click the PrePopulateMBean project, and select Project Properties.. b. In the left pane of the Project Properties dialog, select the "Libraries and Classpath" node. Click Add Library. Page 6 of 29
c. Select ADF Model Runtime and click Add. Page 7 of 29
d. Click Add Library, and add the Resource Bundle Support library. Page 8 of 29
e. Click OK to close the Project Properties dialog. 4. Edit the adfc-config.xml file in the project to create a Managed Bean reference. This reference is used when customizing the Identity Self Service console to activate the methods in the Java class. To do this: a. In the Application pane, navigate to the PrePopulateMBean > Web Content > WEB-INF node. b. Double-click the adfc-config.xml file. Page 9 of 29
c. In the left frame of the adfc-config.xml tab, click Managed Beans. d. Click the "+" symbol to add a new Managed Bean reference. e. Use the table below to populate the fields. Field Name Name Field Value prepopmbean Page 10 of 29
Class Scope com.example.ui.prepop.view.prepopulatembean backingbean 5. Select File > Save All from the JDeveloper menu. 6. Create a Deployment Profile for the project, so that an ADF JAR file is created. To do this, follow the instructions in the tutorial titled "Customizing Oracle Identity Governance : Configuring JDeveloper." 7. Build and deploy the project to the ADF JAR file defined in the previous step. Page 11 of 29
Step 2: Deploying the managed bean to Oracle Identity Governance 1. Use the instructions in the tutorial titled "Customizing Oracle Identity Governance : Configuring JDeveloper" to deploy the ADF library file to Oracle Identity Governance. In summary, these steps are: a. Unpack the oracle.iam.ui.custom.dev-starter-pack.war file to a temporary location. b. Copy the generated ADF JAR file to the WEB-INF/lib directory of the unpacked WAR file. c. Re-pack the oracle.iam.ui.custom.dev-starter-pack.war file. d. Shut down the Oracle Identity Manager managed server instance. e. Using the WebLogic Server console, update the oracle.iam.ui.custom deployment. f. Start the Oracle Identity Manager managed server instance. Page 12 of 29
Step 3: Adding the "Prepopulate" button to the Identity Self-Service console In this step, you customize the Identity Self Service console, adding a button to the request form for an application instance. 1. Sign into the Identity Self Service console as the xelsysadm user. 2. Create and activate a sandbox called prepop. 3. Open the request form for the Oracle Unified Directory application instance. To do this: a. Under Requests, click Catalog b. Enter OUD in the search field, and click the search button c. Click "Add to Cart" d. Click Checkout 4. Bind the managed bean to the form using Web Composer. To do this: a. Click Customize Page 13 of 29
b. From the Web Composer menu in the top left-hand corner of the page, select View > Source. c. Click the area next to the Details label. Page 14 of 29
This selects that particular region for customization. d. In the Confirm Task Flow Edit dialog, click Edit Page 15 of 29
e. Verify that the "showdetailheader: Details" node is selected in Web Composer, and click Edit. f. In the "Component Properties: Details dialog", click the down arrow next to the Binding field and select "Expression Builder." g. Enter the expression: #{backingbeanscope.prepopmbean.rootpanel} and click OK. Page 16 of 29
This tells the web interface to invoke the setrootpanel method in the custom managed bean. h. Click OK to close the Component Properties: Details dialog. Page 17 of 29
5. Add a button to the form to invoke the managed bean. To do this: a. Ensure that the "showdetailheader: Detail" node is still selected. b. Click Add Content. c. In the Add Content dialog, scroll down to the bottom of the list, and click Web Components. Page 18 of 29
d. Next to Command Toolbar Button, click Add. Page 19 of 29
e. Click Close to close the Add Content dialog. f. Select the commandtoolbarbutton node in Web Composer, and click Edit. g. Click the down arrow next to the Text property, and select Expression Builder. Page 20 of 29
h. In the Expression Builder popup, enter Prepopulate and click OK. i. Using the Expression Builder, set the value for the Binding property to #{backingbeanscope.prepopmbean.prepopulatebutton}. Page 21 of 29
j. Edit the Disabled property, adding the following value to the Expression Builder field: #{!backingbeanscope.prepopmbean.prepopulatebuttonrendered} Page 22 of 29
k. Click the Style tab, and set the Width to 100, and the Margin Left to 100. Click OK. l. In the top right corner, click Close to close Web Composer. Page 23 of 29
6. The actionlistener property of the button needs to be modified, but this is not possible from within Web Composer. Manually update the actionlistener property by following these steps: a. Click the "Sandboxes (prepop)" link at the top of the page. b. In the Manage Sandboxes tab, click Deactivate Sandbox. c. Click Export Sandbox, and save the sandbox zip file to a temporary location. d. Unpack the sandbox using the appropriate utility for your operating system - for Linux, unzip, for Windows, WinZip or 7zip. e. Edit the OUDFrm01CreateForm.jsff.xml file. The name of the file depends on the form created during creation of the application instance. In the XML file, look for the commandtoolbar element. Add the actionlistener property to the commandtoolbar element: actionlistener="#{backingbeanscope.prepopmbean.actionlistener}" When edited, the element should look like the following: f. Re-create the zip file, being sure to preserve the file paths, and to remove any backup files created by the editor that you used. Page 24 of 29
g. In the Manage Sandboxes tab in the Identity Self Service console, import the updated sandbox. Click Import Sandbox, navigate to the updated sandbox zip file, and click Import. For your convenience, the sandbox_prepop.zip file contains an already updated sandbox. This sandbox can be used if the request form for the application instance you are customizing has the name OUDFrm01. Page 25 of 29
Step 4: Testing the customization In this step, you activate the sandbox, and test the customization. 1. In the Manage Sandboxes tab, select the sandbox and click Activate Sandbox. 2. Under Administration, click Users. 3. Click Search to search for users, and select a user. In this tutorial, the user Aime McBeth is selected. 4. Select the Accounts sub-tab, and click Request Accounts. Page 26 of 29
5. Enter OUD in the search field, and click the search button. 6. Click "Add to Cart," and then click Checkout. 7. Note that the form now contains a Prepopulate button. Click Preopulate. Page 27 of 29
8. Verify that the First Name and Last Name fields are populated with the first name and last name of the user in the Target Users Page 28 of 29
Page 29 of 29