Feb 12, 2013

Oracle Identity Manager(OIM) API for Account Provisioning

Oracle Identity Manager allows you to provision account using the OIM api. You can use Oracle Identity Manager to create, maintain, and delete accounts on target systems. Oracle Identity Manager becomes the front-end entry point for managing all the accounts on these systems. After the accounts are provisioned, the users for whom accounts have been provisioned are able to access the target systems without any interaction with Oracle Identity Manager. This is the provisioning configuration of Oracle Identity Manager.





Sometimes you will need give account from remote operations (webservice or some remote connector).For this operations , you have to find right application instance for provision account. You can use findApplicationInstanceByName method of oracle.iam.provisioning.api.ApplicationInstanceService service for find application instance. Then,you can provision an application instance with OIM api, usingoracle.iam.provisioning.api.ProvisioningService service.

import oracle.iam.provisioning.api.ProvisioningService;
import oracle.iam.provisioning.api.ApplicationInstanceService;

    public void provisionAccount(String userKey) throws ApplicationInstanceNotFoundException,
                                                                        GenericAppInstanceServiceException,
                                                                        UserNotFoundException,
                                                                        GenericProvisioningException {
  ProvisioningService service=getClient().getService(ProvisioningService.class); 
  ApplicationInstance appInstance=findApplicationInstanceByName("Application Instance Name");
                //serverName example : UD_ADUSER_SERVER
        //itResourceName example : Active Directory
        FormInfo formInfo = appInstance.getAccountForm();
        Map parentData = new HashMap();
        parentData.put(serverName, itResourceName);
        String formKey = String.valueOf(formInfo.getFormKey());
        AccountData accountData = new AccountData(formKey, null, parentData);
        Account account = new Account(appInstance, accountData);
        account.setAccountType(Account.ACCOUNT_TYPE.Primary);
        service.provision(userKey, account);
}

    public ApplicationInstance findApplicationInstanceByName(String applicationInstanceName) throws ApplicationInstanceNotFoundException,
                                                                                                GenericAppInstanceServiceException {
 ApplicationInstanceService service=getClient().getService(ApplicationInstanceService.class);
        ApplicationInstance appInstance=service.findApplicationInstanceByName(applicationInstanceName);
        return appInstance;
    }


No comments:

Post a Comment