Enabling a SOA Composite with Oracle Identity Manager

26-4 Oracle Fusion Middleware Developers Guide for Oracle Identity Manager set up the environment for making the OIM API invocation java.util.Hashtable env = new java.util.Hashtable; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_FACTORY_INITIAL, oimInitialContextFactory; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_PROVIDER_URL, oimURL; oracle.iam.platform.OIMClient client = new oracle.iam.platform.OIMClientenv; client.loginoimUserName, oimPassword.toCharArray; System.out.printlnLogin Successful; get Service oracle.iam.request.api.RequestService reqSvc = client.getServiceoracle.iam.request.api.RequestService.class; oracle.iam.identity.rolemgmt.api.RoleManager roleSvc = client.getServiceoracle.iam.identity.rolemgmt.api.RoleManager.class; oracle.iam.identity.usermgmt.api.UserManager usersvc = client.getServiceoracle.iam.identity.usermgmt.api.UserManager.class; Object reqIdXMLElem = getVariableDatainputVariable, payload, ns3:processns4:RequestID; String reqId = oracle.xml.parser.v2.XMLElementreqIdXMLElem.getText; System.out.printlnThe request ID is +reqId; invoke the getBasicRequestData method on the RequestService API oracle.iam.request.vo.Request req = reqSvc.getBasicRequestDatareqId; java.util.Listoracle.iam.request.vo.Beneficiary beneficiaries = req.getBeneficiaries; ifbeneficiaries = null{ fororacle.iam.request.vo.Beneficiary benf: beneficiaries{ get org key java.util.HashSetString searchAttrs = new java.util.HashSetString; searchAttrs.addoracle.iam.identity.usermgmt.api.UserManagerConstants. AttributeName.USER_LOGIN.getId; searchAttrs.addoracle.iam.identity.usermgmt.api.UserManagerConstants. AttributeName.USER_ORGANIZATION.getId; oracle.iam.identity.usermgmt.vo.User user1 = usersvc.getDetailsbenf.getBeneficiaryKey,searchAttrs, false; actKey = user1.getAttributeact_key.toString; get org admin ifactKey = actKey = { Thor.API.Operations.tcOrganizationOperationsIntf orgAPI = Thor.API.Operations.tcOrganizationOperationsIntfclient.getService Thor.API.Operations.tcOrganizationOperationsIntf.class; Using Oracle Identity Manager APIs in SOA Composites 26-5 Thor.API.tcResultSet rset = orgAPI.getAdministratorsLong.parseLongactKey; StringBuffer sb = new StringBuffer; for int i = 0; i rset.getRowCount;i++{ rset.goToRowi; sb.appendrset.getStringValueGroups.Group Name ; ifi = 0 i rset.getRowCount-1{ sb.append,; } } String grpNames = sb.toString; System.out.printlnGroups=+grpNames; setVariableDataorgAdmin,grpNames; } get role approver java.util.Listoracle.iam.request.vo.RequestBeneficiaryEntity rbes = benf.getTargetEntities; fororacle.iam.request.vo.RequestBeneficiaryEntity rbe : rbes{ String key = rbe.getEntityKey; String type = rbe.getEntityType; iftype.equalsIgnoreCaseRole{ java.util.HashSetString roleAttrs = new java.util.HashSetString; roleAttrs.addRole Approver; oracle.iam.identity.rolemgmt.vo.Role role = roleSvc.getDetailskey,roleAttrs; roleApprover = Stringrole.getAttributeRole Approver; setVariableDataroleApprover, roleApprover; break; } } break; } } System.out.printlnOrgAdmin= + getVariableDataorgAdmin.toString; System.out.printlnroleApprover= + getVariableDataroleApprover.toString; } catch Exception e{ System.out.println----------------------; e.printStackTrace; System.out.println----------------------; } In Example 26–1 , to retrieve the organization administrator by using Oracle Identity Manager APIs, the following is performed in the Java code:

a. Get credentials for the system administrator.

Credentials of the system administrator are stored in a credential store cwallet. First, the credential store, then the credential map, and then the credential by using the key are retrieved. This is shown in the following code snippet: 26-6 Oracle Fusion Middleware Developers Guide for Oracle Identity Manager get Credential store oracle.security.jps.JpsContext ctx = oracle.security.jps.JpsContextFactory.getContextFactory.getContext; final oracle.security.jps.service.credstore.CredentialStore cs = oracle.security.jps.service.credstore.CredentialStorectx.getServiceInstan ce oracle.security.jps.service.credstore.CredentialStore.class; get Credential oracle.security.jps.service.credstore.CredentialMap cmap = cs.getCredentialMaporacle.oim.sysadminMap; oracle.security.jps.service.credstore.Credential cred = cmap.getCredentialsysadmin;

b. Login as system administrator.

The environment is setup, and then logged in to Oracle Identity Manager as system administrator. This is shown in the following code snippet: setup the environment String oimInitialContextFactory = weblogic.jndi.WLInitialContextFactory; java.util.Hashtable env = new java.util.Hashtable; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_FACTORY_INITIAL, oimInitialContextFactory; env.putoracle.iam.platform.OIMClient.JAVA_NAMING_PROVIDER_URL, oimURL; login to OIM oracle.iam.platform.OIMClient client = new oracle.iam.platform.OIMClientenv; client.loginoimUserName, oimPassword.toCharArray; System.out.printlnLogin Successful;

c. Retrieve the organization administrator and the role approver.

This is done by using the following Oracle Identity Manager APIs: oracle.iam.request.api.RequestService: Used to retrieve the request object Thor.API.Operations.tcOrganizationOperationsIntf: Used to retrieve the organization administrator oracle.iam.identity.usermgmt.api.UserManager: Used to retrieve the role approver

26.2.4 Deploying the SOA Composite

Before deploying the SOA composite, set the BPELClasspath property in the System MBean Browser of the Enterprise Manager. After updating the composite, you must deploy the composite to SOA. To do so:

1. In the Projects section, right-click the composite name, and select Deploy.

2. Select the DefaultRequestApproval ... option. A wizard is displayed that prompts you to select the application server on which the composite is to be deployed. Make sure you select the application server connection created earlier. In addition, select the Override any existing composites with the same revision ID option if you want to override the composite that is already deployed. See Also: Oracle Fusion Middleware Java API Reference for Oracle Identity Manager for information about Oracle Identity Manager APIs