Wednesday, 19 July 2017

OIM - AD Connector Issue: "There is no such object on the server"

After installing the Active Directory connector in OIM, if you find the below error that means AD is trying to find something in its OU during creation of new objects, but unable to find those.

<ERROR>: Class-> ActiveDirectoryConnector Method -> Create, Message -> Encountered DirectoryServicesCOMException: There is no such object on the server.

Resolution

Sometime after installing the AD connector, it by default creates some prepopulate adapters. Manager prepopulate is one of the default one.

According to the provisioning process if you choose manager of the user, then manager DN must be present in AD. other wise you will face the above error.

During previsioning, select a manager who is there in AD and the error will disappear and provisioning will be successful.

Friday, 9 June 2017

Unable to modify Disconnected Application Instance with non-Entitlement child data in OIM 11.1.2.3.0



Problem Description

When we create any disconnected application instance with child form in OIM 11gR2 PS1, we add the multivalued attribute into child dataset. This multivalued attribute hold the role data of the application. This can be set in 2 ways,


Either as Entitlement, where the role data will be visible in catalog as entitlement and can be added to child form directly using Modify Account option.


Or Only as Application Role, where role data will not be exposed as entitlements in catalog, and only option to add is to modify account.


if you go with the first option where role data are exposed as entitlements, then you have to select the Entitlement check box in the attribute configuration.




once you do that, automatically in the corresponding process definition 2 tasks are added for child data grant and revoke.


But if you choose the option 2, where child data are not exposed as entitlements, then no extra process task gets created in process definition. Only the form update task will be responsible for adding and removing child data in application instance.






Using option 2, when any one add a role through "Modify Account" process, "UD_[APP_NAME] Updated" task gets triggered and assign task for fulfillment.


In OIM 11.1.2.3.0 if you create disconnected application instance with 2nd option, then it will not work properly. When you add any role data in child table through "Modify Account" process, no process task gets triggered. As a result records get added in OIM database (child table), but no fulfillment task assigned to implementers.




Resolution (as of now)
Create the process task for each operation manually (insert, update, delete in child table), and map the adpMANUALPROVISIONING adapter.



Monday, 5 June 2017

Retrive Weblogic CSF credentials using Java and Jps API

WebLogic CSF (Credential Store Framework) holds security data of WebLogic domain like credential. A credential can hold user name and password combinations, tickets, or public key certificates.

WebLogic CSF has 2 different types
          1. Password - A password credential encapsulates a user name and a password
          2. Generic - A generic credential encapsulates any customized data or arbitrary token.

This CSF can also be used for storing credential of other applications like OIM, SOA etc. and can be used for authentication from customized applications. For example if some one wants to create an Web Service to call OIM or SOA APIs, person need to authenticate in OIM or SOA. In that scenario we can use WebLogic CSF to store and use the credential of OIM or SOA.

The below code snippet will describe how to get the credential from WebLogic CSF using java. This code can be used only from the WebLogic domain application.



private void getCredential() throws Exception{
/*
* Initializing JpsContext with current factory context.
* oracle.security.jps.JpsContext can be found under jps-api.jar
*/
oracle.security.jps.JpsContext ctx = oracle.security.jps.JpsContextFactory.getContextFactory().getContext();

final oracle.security.jps.service.credstore.CredentialStore cs = (oracle.security.jps.service.credstore.CredentialStore) ctx
.getServiceInstance(oracle.security.jps.service.credstore.CredentialStore.class);

/*
* Below section is for getting data from CSF of type Passsowrd
* "oracle.wsm.security" is Credential Map name
* "SOAAdmin" is the Password CSF key name
*/
oracle.security.jps.service.credstore.CredentialMap cmap = cs.getCredentialMap("oracle.wsm.security");
oracle.security.jps.service.credstore.Credential cred = cmap.getCredential("SOAAdmin");

if (cred instanceof oracle.security.jps.service.credstore.PasswordCredential) {
oracle.security.jps.service.credstore.PasswordCredential pcred =
(oracle.security.jps.service.credstore.PasswordCredential)cred;

char[] p = pcred.getPassword();
String UserName = pcred.getName();
String Password = new String(p);

System.out.println("UserName : " + UserName);
System.out.println("Password : " + Password);

}

/*
* Below section is for getting data from CSF of type Generic.
* "oracle.wsm.security" is Credential Map name
* "oimurl" is the custom Generic CSF key name
*/


oracle.security.jps.service.credstore.CredentialMap cmapURL = cs.getCredentialMap("oracle.wsm.security");
oracle.security.jps.service.credstore.Credential credURL = cmapURL.getCredential("oimurl");

if (credURL instanceof oracle.security.jps.service.credstore.GenericCredential){
oracle.security.jps.service.credstore.GenericCredential gcred = (oracle.security.jps.service.credstore.GenericCredential) credURL;

if (gcred.getCredential() instanceof Hashtable){

/*
*This hash table contains all the key value pair of generic CSF
*/
Hashtable result = (Hashtable) gcred.getCredential();

String URL = new String((char[]) result.get("oimurl"));
String confPath = new String((char[]) result.get("confPath"));

System.out.println("URL : "+URL);
System.out.println("confPath : "+confPath);

}
}
}

Tuesday, 30 May 2017

Decrypt user's password in OIM 11gR2 PS3

In OIM 11gR2 PS1 we were able to get the user's password in clear text using below java code

tcDataProvider dbProvider = new tcDataBaseClient();
String query = "select USR_LOGIN,USR_PASSWORD from USR where USR_LOGIN=UPPER('"+uid+"')";
tcDataSet dataSet = new tcDataSet();
dataSet.setQuery(dbProvider, query);
dataSet.executeQuery();
System.out.println("Password:: "+dataSet.getString("USR_PASSWORD"));

Starting from OIM 11gR2 PS2 this process no longer applicable, even if you run the above code in PS2 or PS3 version, this will give you ********* instead of clear text password.


I have found a way to get the user's password in clear text in OIM 11gR2 PS3 version. Execute the below procedure to get the same

1. take an ITResource in OIM and update password in password field.

     In my case I choose ITResource "Directory Server" and update "Admin Password" field.
    

2. From SQL Developer run the below query to get the database field of that ITResource

       select spd.SPD_FIELD_NAME, svp.SVP_FIELD_VALUE from spd, svp where
        spd.spd_key = svp.spd_key and
        spd.svd_key = (select svd_key from svr where svr_name = 'Directory Server') and
        svp.svr_key = (select svr_key from svr where svr_name = 'Directory Server')

        Output
       



3. Find out the password field that you updated from sysadmin console. You can see the password is encrypted.

4. Now run below query to get the encrypted password of OIM user

     select USR_PASSWORD from USR where USR_LOGIN='XELSYSADM';

     Output: 3412:ElLNJh2hLSqX+OdI9CxS8Q==

5. Now copy the password of XELSYSADM and update the "Admin Password" field in ITResource from database table.

6. Now run the below method to get the password of XELSYSADM in clear text


public void getITResourceParameter() throws Exception {


final String methodName = "::getITResourceParameter::";


Map phAttributeList = new HashMap();
phAttributeList.put("IT Resources.Name", "Directory Server");


HashMap paramMap = new HashMap();


tcITResourceInstanceOperationsIntf ITResourceAPI = (tcITResourceInstanceOperationsIntf)oimClient.getService(tcITResourceInstanceOperationsIntf.class);

tcResultSet itresSet = ITResourceAPI.findITResourceInstances(phAttributeList);
itresSet.goToRow(0);

String ITResourceKey = itresSet.getStringValue("IT Resources.Key");
System.out.println("ITResourceKey::"+ITResourceKey);

tcResultSet paramValuesRS = ITResourceAPI.getITResourceInstanceParameters(Long.parseLong(ITResourceKey));

for(int j=0;j<paramValuesRS.getTotalRowCount();j++){

paramValuesRS.goToRow(j);
paramMap.put(paramValuesRS.getStringValue("IT Resources Type Parameter.Name"), paramValuesRS.getStringValue("IT Resources Type Parameter Value.Value"));

}


String adminPassword = (String) paramMap.get("Admin Password");


System.out.println("adminPassword ::"+adminPassword);

}


You can use any user instead of XELSYSADM to get their OIM password in clear text.

Explanation    
1. Even if in OIM PS3 version, they block the dataset API to get the password in clear text from USR table, but ITResource API still capable of getting ITResource password in clear text from database.

2. OIM still use single encryption mechanism to encrypt all of its password.

Now if you can replace the encrypted password from USR table to SVP table of ITResource, then you can use the ITResource API to get the password.

** Oracle still need to work on this to enhance the security of user's password.

Monday, 29 May 2017

Get Parrent and Child request details of OIM

The below code snippet will give u the details of the Parent and Child request details of a given request id.



public void getRequestDetails(String reqId) throws Exception{

OIMClient oimClientObj = getRequesterConnection("xelsysadm");
RequestService reqAPI = (RequestService)oimClientObj.getService(RequestService.class);

/**
* Get parent request details
*/

Request req = reqAPI.getBasicRequestData("34002");
Request pReq = req.getParentRequest();
System.out.println("Parent Request: "+pReq.getRequestID());

/**
* get the child request details
*/
pReq = reqAPI.getBasicRequestData(pReq.getRequestID());
List<Request> cReqs = pReq.getChildRequests();

System.out.println("Other Chlied request for entitlements");


for (int i=0; i<cReqs.size(); i++){

System.out.println(cReqs.get(i).getRequestID()+" : "+cReqs.get(i).getRequestModelName());

}

}

Output

Parrent Request: 34001
Other Chlied request for entitlements
34002 : Provision ApplicationInstance
34003 : Provision Entitlement
34004 : Assign Roles



Approving OIM request programatically using BEPL APIs

Using BEPL APIs one can programmatically perform actions on a OIM request. Below is an example of the same.

1. Create a project in eclipse.
2. Copy the below jars from servers

            [WL_HOME]/server/lib/weblogic.jar
      [SOA_HOME]/soa/modules/oracle.soa.fabric_11.1.1/bpm-infra.jar
      [SOA_HOME]/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar
      [SOA_HOME]/soa/modules/oracle.soa.workflow_11.1.1/bpm-services.jar
      [WL_HOME]/server/lib/wlfullclient.jar

      [OIM_HOME]/server/ext/spml/wsclient_extended.jar

3. Set the above jars in your project classpath
4. Use the below code in your project.


import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;


import com.bea.security.providers.xacml.entitlement.parser.Predicate;
import oracle.bpel.services.workflow.WorkflowException;
import oracle.bpel.services.workflow.client.config.RemoteClientType;
import oracle.bpel.services.workflow.client.config.RemoteClientType.Password;
import oracle.bpel.services.workflow.client.config.ServerType;
import oracle.bpel.services.workflow.client.config.WorkflowServicesClientConfigurationType;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
import oracle.bpel.services.workflow.query.ITaskQueryService;
import oracle.bpel.services.workflow.query.ITaskQueryService.AssignmentFilter;
import oracle.bpel.services.workflow.repos.TableConstants;
import oracle.bpel.services.workflow.task.ITaskService;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.verification.IWorkflowContext;



 

public class ApproveOIMRequest {

public void approveRequest(String reqId) throws Exception{
Logger logger = Logger.getLogger(ApproveOIMRequest.class.getName());

/**
* Adding SOA server and its properties into the WorkflowServicesClientConfigurationType
*/

WorkflowServicesClientConfigurationType wssst = new WorkflowServicesClientConfigurationType();
List<ServerType> servers = wssst.getServer();
ServerType server = new ServerType();
server.setDefault(true);
server.setName("soa");

servers.add(server);


/**
* Creating remote client with all the SOA server connection parameters including login user as xelsysadm.
*/

RemoteClientType rct = new RemoteClientType();
rct.setServerURL("t3://ess.com:8001");
rct.setUserName("xelsysadm");
Password weblogicPWD = new Password();
weblogicPWD.setValue("Welcome1");
rct.setPassword(weblogicPWD);
rct.setInitialContextFactory("weblogic.jndi.WLInitialContextFactory");
rct.setParticipateInClientTransaction(false);

server.setRemoteClient(rct);

/**
* Creating remote enterprise java bean interface to invoke workflow
* service located remotely from the client.
*
* After creating IWorkflowServiceClient object, get the Query Service.
*/

IWorkflowServiceClient wfsc = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,wssst,logger);

ITaskQueryService qService = wfsc.getTaskQueryService();

/**
* Authenticating using xelsysadm
*/

String xelsysadmPassword = "Welcome1";
IWorkflowContext wctx = qService.authenticate("xelsysadm", xelsysadmPassword.toCharArray(), null);

/**
* List the column name to get the value from query service.
* the columns are all from WFTASK table in SOAINFRA schema.
*/

List queryColumns = new ArrayList();
queryColumns.add("TASKID");
queryColumns.add("TASKNUMBER");
queryColumns.add("TITLE");
queryColumns.add("OUTCOME");
queryColumns.add("IDENTIFICATIONKEY");


/**
* Assigning filter for selecting assigned tasks
*/

AssignmentFilter assignmentFilter = AssignmentFilter.ALL;
/**
* List all the assignd tasks for logged in user.
*/

List tasks = qService.queryTasks(wctx, queryColumns, null, assignmentFilter, null, null, null, 0, 0);


/**
* get the object of task service in order to perform actions on tasks.
*/
ITaskService taskService = wfsc.getTaskService();

System.out.println("tasks.size() :"+tasks.size());
/**
* Iterate the list of tasks and check for the request id and status.
* if the status is not APPROVED and request id gets matched, then
* perform update task like APPROVE the task
*/

for (int i=0; i<tasks.size(); i++){

//System.out.println("Task found for request id: "+reqId);
Task task = (Task) tasks.get(i);
int taskNumber = task.getSystemAttributes().getTaskNumber();
String taskTitle = task.getTitle();
String taskId = task.getSystemAttributes().getTaskId();
String taskOutcome = task.getSystemAttributes().getOutcome();
String identificationKey = task.getIdentificationKey();

//System.out.println(taskNumber+" "+taskTitle+" "+taskOutcome+" "+identificationKey);

if (identificationKey.equalsIgnoreCase(reqId) && taskOutcome == null){
System.out.println(taskNumber+" "+""+" "+taskOutcome+" "+identificationKey);
taskOutcome = "APPROVE";
taskService.updateTaskOutcome(wctx, taskId, taskOutcome);

}

}

System.out.println("Done");
}


public static void main(String[] args) {

ApproveOIMRequest a = new ApproveOIMRequest();

try {
a.approveRequest("32001"); //Request Id is the input parameter.
} catch (Exception e) {

e.printStackTrace();

}

}

}


Wednesday, 24 May 2017

Weblogic bsu - java.lang.OutOfMemoryError

sometime you can find the java heap space issue while applying weblogic patches using bsu. The error looks like below


Exception in thread "main" Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space
        at java.util.HashMap.createEntry(HashMap.java:897)
        at java.util.HashMap.addEntry(HashMap.java:884)
        at java.util.HashMap.put(HashMap.java:505)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.loadPropertyMap(XBeanDataHandler.java:778)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.<init>(XBeanDataHandler.java:99)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.createDataHandler(XBeanDataHandler.java:559)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.getComplexValue(XBeanDataHandler.java:455)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:442)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:464)
        at com.bea.plateng.patch.dao.cat.PatchCatalog.getPatchDependencies(PatchCatalog.java:56)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getInvalidatedPatchMap(PatchCatalogHelper.java:1621)
        at com.bea.plateng.patch.PatchSystem.updatePatchCatalog(PatchSystem.java:436)
        at com.bea.plateng.patch.PatchSystem.refresh(PatchSystem.java:130)
        at com.bea.plateng.patch.PatchSystem.<init>(PatchSystem.java:114)
        at com.bea.plateng.patch.PatchSystem.<clinit>(PatchSystem.java:41)
        at com.bea.plateng.patch.Patch.main(Patch.java:279)
java.lang.NoClassDefFoundError: Could not initialize class com.bea.plateng.patch.PatchSystem
        at com.bea.plateng.patch.PatchClientHelper.getAllPatchDetails(PatchClientHelper.java:74)
        at com.bea.plateng.patch.PatchInstallationHelper.cleanupPatchSets(PatchInstallationHelper.java:130)
        at com.bea.plateng.patch.PatchTarget.<init>(PatchTarget.java:272)
        at com.bea.plateng.patch.PatchTargetFactory.create(PatchTargetFactory.java:30)
        at com.bea.plateng.patch.ProductAliasTarget.constructPatchTargetList(ProductAliasTarget.java:88)
        at com.bea.plateng.patch.ProductAliasTarget.<init>(ProductAliasTarget.java:46)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getProdAliasTargetList(ProductAliasTargetHelper.java:55)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getAllHomeToProdAliasesTargetMap(ProductAliasTargetHelper.java:32)
        at com.bea.plateng.patch.ProductAliasTargetHelper.checkProfilesInProductAliases(ProductAliasTargetHelper.java:133)
        at com.bea.plateng.patch.Patch$1.run(Patch.java:376)
        at java.lang.Thread.run(Thread.java:745)





Solution


1. open the bsu.sh (MIDDLEWARE_HOME/utils/bsu/bsu.sh) file edit mode
2. change the memory args value as below


From


MEM_ARGS="-Xms256m -Xmx512m"


To


MEM_ARGS="-Xms512m -Xmx1024m"


3. Save the file and run bsu again.

Followers

OIM API for adding process task and retry failed task

 In this blog you can find how to add new process task and retry any failed/rejected tasks using API. Adding new process task: /************...