Showing posts with label OIM Connector Pack. Show all posts
Showing posts with label OIM Connector Pack. Show all posts

Monday, October 13, 2008

Random Password Generator

A lot of places we need to create and apply Random Password upon granting a resource or creation of OIM user via code. Here is a code that would generate one and will also allow you to specify the length of random password.

================================
RandomPasswordGenerator.java
================================

import java.util.Random;

public class RandomPasswordGenerator {

public static int DEFAULT_PASSWORD_LENGTH=8;
public static char[] Special_Character = {'!','@','#','$','%','^','&','*','(',')' };
public static char getSpecialCharacter(){
Random rand = new Random();
int randInt = rand.nextInt(10);
return Special_Character[randInt];
}

public static String getPassword(int n) {
if(n <=8 ){
n=DEFAULT_PASSWORD_LENGTH;
}
char[] pw = new char[n];
int c = 'A';
int r1 = 0;
int i=0;
String tempString = new String();
while(i< n){
r1 = (int)(Math.random() * 4);
l1: switch(r1) {
case 0: c = '0' + (int)(Math.random() * 10); break l1;
case 1: c = 'a' + (int)(Math.random() * 26); break l1;
case 2: c = 'A' + (int)(Math.random() * 26); break l1;
case 3: c = getSpecialCharacter(); break;
}

char c1 = (char)c;
boolean isExisting = false;
l2: for(int j=0; j < i; j++){
if(c1 == pw[j]){
isExisting = true;
break l2;
}
}
if(!isExisting){
pw[i] = (char)c;
i++;
}

}
return new String(pw);
}
public static void main(String args[]){
System.out.println(RandomPasswordGenerator.getPassword(8));
}
}

===============================
Output would be something like:
===============================
&3FVZfxb

ACF2 Connector Details

Clarity on ACF2 Connector
==========================
Please note: Port numbers are configurable.

Pioneer & Voyager are installed on ACF2.
ldap gateway sits on OIM.

Usually, 5190 is the port on the OIM server in which the ldap gateway listens on. Voyager points to the OIM server on port 5190. PIONEER is the listener on the mainframe, the default port is 5790 (Typically 5790 unless it is reserved for another service).


Few Data Types Explored
=========================

1. TOD - String Time-of-day attribute (This is an internal MF format. It's the value returned by the TIME macro) (http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=/com.ibm.zsecure.doc/ckrbzz1902.html)


2. PACKED - Date Field (PACKED is a MF format -- basically, it's a number, but rather than being stored in binary, it's stored in a format where each nibble is one digit and the last nibble denotes the sign.

Example: x''01234C' would be 1234 (positive)) http://webster.cs.ucr.edu/AoA/Windows/HTML/DataRepresentationa7.html


3. HEX - String (hexidecimal data)

4. TIMEBIN - String (TIMEBIN is a fullword; that's 4 bytes and it's the number of .01 secs since midnight.)

5. CHEN - CHEN is character (but encrypted)

For other attributes, refer http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=/com.ibm.zsecure.doc/ckrbzz1902.html

Friday, October 10, 2008

Searching Jar Files in Unix / Linux

Lot of times we get the following errors:
Exception in thread "main" java.lang.NoClassDefFoundError: server

And we just don't know which jar file is missing from the classpath. And we need to know the correct jar file name(s) to fix the problem. So, here I create a shell script that would allow you to search through all the jar files by specifying a specific keyword. You may modify this script to search in all files (*) or whatever your criteria may be. This script works recursively for all sub-folders as well. So, you can keep this script on the root level of search and simply execute it.

=====================================
searchjars.sh
=====================================


#!/bin/sh

if [ $# -ne 1 ];
then
echo "Usage: ./searchjars.sh <keyword>"
exit
fi

LOOK_FOR="$1"

for i in `find . -name "*jar"`
do
#echo "Looking in $i ..."
jar tvf $i | grep $LOOK_FOR > /dev/null
if [ $? == 0 ]
then
echo "==> Found \"$LOOK_FOR\" in $i"
fi
done


After saving this file, don't forget to give the execute permissions to this script.

[jboss@lin01 xlclient]$chmod +x searchjars.sh

Now you are ready to execute as follows:

If you don't specify any value, the script shows you the usage command:
[jboss@lin01 xlclient]$ ./searchjars.sh
Usage: ./searchjars.sh <keyword>

When you specify the value to be searched, you will see the files that have that value in it.
[jboss@lin01 xlclient]$ ./searchjars.sh server
==> Found "server" in ./java/lib/rt.jar
==> Found "server" in ./ext/jdbcpool-0.99.jar
==> Found "server" in ./ext/nexaweb-nfc-api.jar
==> Found "server" in ./ext/jai_core.jar
==> Found "server" in ./ext/javagroups-all.jar
==> Found "server" in ./ext/jbossall-client.jar
==> Found "server" in ./ext/jboss-client.jar
==> Found "server" in ./ext/nexaweb-common.jar
==> Found "server" in ./ext/soap.jar
==> Found "server" in ./lib/xlVO.jar
==> Found "server" in ./lib/XellerateClient.jar
[jboss@lin01 xlclient]$

If you need to see what files are being looked at, uncomment (remove the #) the following line in the script:
#echo "Looking in $i ..."

Wednesday, September 3, 2008

Oracle Support on VMWare / Virtualized environment

Oracle does not support Oracle Products installed on VMware as Oracle has not certified any of its products on VMware virtualized environments.

If the issue does not occur in a non-virtual deployment, you will be referred to work with VM Product Company.

For details, look on oracle metalink (https://metalink.oracle.com) for the following document:

Support Position for Oracle Products Running on VMWare Virtualized Environments

Doc ID: Note:249212.1 Type: ANNOUNCEMENT
Last Revision Date: 16-NOV-2007 Status: PUBLISHED

Thursday, August 28, 2008

Finding OIM Task Key in a Process Definition

Finding OIM Task Key in a Process Definition in OIM 9.1 is possible through a new API:

Thor.API.Operations.TaskDefinitionOperationsIntf --> getTaskDetails()

Finding an OIM Task Key in a Process Definition in PRE- OIM 9.1 releases can be achieved using the following sql:

String sql = "SELECT m.mil_key FROM mil m, pkg p, tos t WHERE m.mil_name = '" + taskName + "' AND m.TOS_KEY = t.TOS_KEY AND t.PKG_KEY = p.PKG_KEY AND p.pkg_name='"+ processname + "'";

Update Active Directory Password with Code

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.ldap.*;
import java.util.*;
import java.security.*;

public class ADUpdatePwd

{

private DirContext ldapContext;

private String baseName = ",ou=People,dc=bhatiacorp,dc=com";

private String serverIP = "127.0.0.1";

public void updatePassword(String username, String password) {
try {
String quotedPassword = "\"" + password + "\"";
char unicodePwd[] = quotedPassword.toCharArray();
byte pwdArray[] = new byte[unicodePwd.length * 2];
for (int i = 0; i < unicodePwd.length; i++) {
pwdArray[i * 2 + 1] = (byte) (unicodePwd[i] >>> 8);
pwdArray[i * 2 + 0] = (byte) (unicodePwd[i] & 0xff);
}

ModificationItem[] mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("UnicodePwd", pwdArray));
ldapContext.modifyAttributes("cn=" + username + baseName, mods);
} catch (Exception e) {
System.out.println("ADUpdatePwd :: Update Password Error :: " + e);

}
}

private void setContext(String ldaphost, String ldapport, String adminID, String adminpassword, boolean useSSL) {
String providerurl = ldaphost + ":" + ldapport;
if (ldapport == "") {
ldapport = "636";
}
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, providerurl);
if (useSSL == true) {
// if SSL is used - use can use ssl enabled ldaphost
// eg. "ldaps://localhost:636"
// else
// eg. "ldap://localhost:636"
env.put(Context.SECURITY_PROTOCOL, "ssl");
}
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, adminID);
env.put(Context.SECURITY_CREDENTIALS, adminpassword);
ldapContext = new InitialDirContext(env);
} catch (Exception ex) {
ex.printStackTrace();
}
}


public ADUpdatePwd() {
try {
setContext("ldaps://serverIP", "636", "CN=Administrator"+baseName, "p@ssw0rd1~", true);
} catch (Exception e) {
System.out.println("ADUpdatePwd :: Error :: " + e);
e.printStackTrace();

}
}

public static void main(String[] args) {
try {
/*
* Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); the keystore that holds trusted root certificates
* System.setProperty("javax.net.ssl.trustStore", "c:\\myCaCerts.jks");
* System.setProperty("javax.net.debug","all");
*/

ADUpdatePwd c = new ADUpdatePwd();
c.updatePassword("Bhatiar", "p@ssw0rd3");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

Thursday, August 21, 2008

OIM Tables Descriptions (9.0.1.1)

The following table lists the purpose of each table within OIM.

Note: Custom Tables are created for user defined Object / Process Forms.

TABLE NAME IN OIMDESCRIPTION OF TABLE
AADList To Define The Administrators For Each Organization And Their Delegated Admin Privileges
AAPTable for storing Resource - Organization level parameter Values
ACPACP - Link Table That Holds Reference To ACT And PKG Tables, Table That Defines The Objects (Resources) Allowed For A Particular Organization
ACSLink Table for Account Table(ACT) and Server Table(SVR)
ACTDefines information about all organizations created through Xellerate
ADJContains the Java API information for the constructor with parameters and method name with parameters chosen for an adapter task of type JAVA, UTILITY, TAME,REMOTE, or XLAPI.
ADLContains the all of the necessary parameters for an adapter task of type IF, ELSE IF,FOR, WHILE, SET, and VARIABLE tasks. These type of tasks are known as LOGICTASKS
ADMData mapping between parameters input/output parameters and source/sink
ADPDefines an adapter created through the Adapter Factory
ADSDatabase,schema and procedure name selections which define a stored procedure adaptertask
ADTDefines a task attached to an adapter
ADUContains the web service and method chosen for a task of the Adapter Factory
ADVAdapter variable table contains variables that have been created for specific adapters.
AFMLinks an adapter with a form
AGSHolds the definition of organization/contact groups
AOAContains the OpenAdapter property file for OpenAdapter
APATo store attestation process administrators
APDTo store attestation Process definition
APTTo store the attestation tasks
ARSContains custom response codes for 'Process Task' Adapters only
ATDTo store entitlement details for each attestation task
ATPDefines input and output parameters for the constructor and method of an adapter taskof type JAVA, UTILITY, TAME, REMOTE, and XLAPI
ATRTo store attestation requests
ATSStores which services or can be ordered by which organizations and which rates apply
AUDDefine the Auditors
AUD_JMS
CRTTrusted Certificate Information
DAVStores the runtime data mappings for 'Entity' & 'Rule Generator' adapters. The data source being an Xellerate form or child table,or a user defined process form.
DEPDependencies among Tasks Within A Workflow Process
DOBData Resource definition consisting of the fully qualified class name of the dataobject
DVTDefines the one to many relationship between Data Resources and Event Handlers (this includes adapters)
EIFExport Import Files. Each row contains one single file used in export/import operation. For export there is only one file
EIHExport Import History. Each row represents one Data Deployment Management session.
EILDB Based lock for export operation. Used to make sure only one user can import at atime. This is currently not managed through data objects
EIOExport Import Objects. Each row represents one object exported/imported
EISSubstitutions used during import process
EMDCore --Email Definition Information Table That Holds The Email Template Definitions
ERRError codes
ESDEncrypted columns not within the bounds of the SDK
EVTDefines event handlers by providing a process and class name. In addition the scheduling time of when the event handler can execute is set to pre (insert, update, delete) or post (insert, update, delete)
FUGList to define the administrators for each user defined object in the 'StructureUtility' form or for each user defined field in the 'User Defined FieldDefinition' form
GPGList to define the (nested) group members of User Group in the 'User Group' form.
GPPList to define the Administrators and their delegated admin rights over a User Group
GPYJoins Properties (PTY) and Groups (UGP).
IEITable where all the imports and exports are defined
LAYTable where the layouts are defined for the various imports and exports
LITImport/export table.
LKULookup definition entries
LKVLookup values
LOBImport/export table.
LOCHolds information about locations
MAPXML MapSchema Information
MAVStores the runtime data mappings for 'Process Task' adapters. The data source being a process form, Location, User, Organization, Process, IT Resource, orLiteral data.
MEVE-mail notification events
MILHolds information about tasks of a process
MSGDefines the user groups that have permission to set the status of a process task.
MSTTask Status And Object Status Information. Holds All The Task Status To Object Status Mappings
OBAObject Authorizer Information
OBDObject Dependencies
OBIObject Instance Information
OBJResource Object definition information.
ODFHolds Object To Process Form Data Flow Mappings.
ODVObject Events/Adapters Information
OIOObject Instance Request Target Organization Information.
OIUObject Instance Request Target User Information.
OODObject Instance Request Target Organization Dependency Information.
ORCThis Entity Holds The Detail On Each Order. This Could Be Considered The Items Section Of An Invoice. This Entity Is The Instance Of A Particular Process
ORDHolds information that is necessary to complete an order regardless of a processbeing ordered
ORFResource Reconciliation Fields
ORRObject Reconciliation Action Rules
OSHTask Instance Assignment History
OSIHolds information about tasks that are created for an order
OSTObject Status Information
OUDObject Instance Request Target User Dependency Information. Holds The Dependency Between Different Resource Instances Provisioned To A User.
OUGList to define the administrators for each Resource
PCQHolds the challenging questions and answers for a user
PDFPackage data flow table holds the data flow relationships between packages
PHOHolds all communication addresses for this contact -- e.g., contact telephone numbers,fax numbers, e-mail, etc.
PKDPackage dependency table holds the dependency relationships between child packages of a parent package
PKGConsists of names and system keys of service processes, which consist of a group ofservices from the TOS table. Defines a Process in Xellerate.
PKHPackage Hierarchy Table Holds The Parent-child Relationships Between Processes
POCStores values for the child tables of the Object/Process form of a resource being provisioned by an access policy
POFPolicy field table holds the field value pairs that constitute the definition of apolicy
POGJoin table between Policy and User Groups, Specifies the groups to whom an access policy will apply.
POLPolicy Table Holds A Policy, Defines An Access Policy In The System
POPPolicy Package Join Table Holds The Packages That A Particular Policy Orders For User, Defines Which Resources Will Be Provisioned Or Denied For A Particular Access Policy.
PRFProcess Reconciliation Field Mappings
PRODefines a process name, scheduling frequency, and priority. A process is made up of oneor more tasks
PTYClient Properties Table
PUGList to define The Administrators And Their Delegated Admin Rights For Each Process.
PWRTable forPassword Rule Policies
PXDTable that holds the list of all Proxies Defined
QUEAdministrative queues definition
QUMAdministrative queue members
RAVStores the runtime data mappings for 'Pre-populate' adapters. The data source being an Xellerate form or child table, or a user defined form
RCAReconciliation Event Organizations Matched
RCBReconciliation Event Invalid Data
RCDReconciliation Event Data
RCEReconciliation Events
RCHReconciliation Event Action History
RCMReconciliation Event Multi-Valued Attribute Data
RCPReconciliation Event Processes Matched
RCUReconciliation Event Users Matched
REPTable that contains all information about reports in the system
REQThis table holds request information
RESThis table is used to stored adapter resources entered by the user.
RGMTable for Response Code Generated Milestones
RGPRules To Apply To A User Group, Defines The Auto-group Membership Rules Attached To AParticular Group.
RGSDefines all known registries. These are used by Web Service tasks in an Adapter to communicate with a web service
RIORequest Organizations Resolved Object Instances
RIURequest Users Resolved Object Instances
RLOThis table contains directory URLs which are referenced by Adapter Factoryjar/class files.
RMLRules To Apply To Task, Defines The Task Assignment Rules Attached To A Process Task.
ROPRules To Apply To An Object-process Pair, Defines The Process Determination Rules Attached To A Resource Object.
RPCReconciliation Event Process Child Table Matches
RPGLink table between Group table and Report Table. Specifies which group has accessto which reports
RPPParameters passed to report.
RPTStores information related to the creation of reports
RPWRules To Apply To A Password Policy, Defines The Policy Determination Rules Attached To A Password Policy.
RQARequest target organization information.
RQCRequest comment information
RQDContains self-registration request data for web admin.
RQERequest administrative queues
RQHRequeststatus history
RQORequest object information.
RQURequest object target user information
RQYRequest Organizations Requiring Resolution
RQZRequest Users Requiring Resolution
RREReconciliation User Matching Rule Elements
RRLReconciliation User Matching Rules
RRTReconciliation User Matching Rule Element Properties
RSCDefines the All The Possible Response Code For A Process Task.
RUEDefines the Elements In A Rule Definition.
RUGList to define the administrators for each Request
RULRule definitions
RVMHolds Recovery Milestones
SCHHolds specific information about an instance of a ask such as its status orscheduled dates
SDCColumn metadata.
SDHMeta-Table Hierarchy.
SDKUser define data object meta data definition
SDLSDK version labels
SDPUser defined column properties
SELData Object Permissions For Groups On A Specified Data object
SITThe SIT table contains information about sites. Sites are subsets of locations.
SPDIT Resource parameter definition
SREDefines Which Pre-populate Rule Generator Will Run For A Field Of User Defined DataObject.
SRPShould be replaced by the rate table from a billing system. Here it holdspecific rates for specific services.
SRSIT Resource - IT Resource join
STAStatus Codes
SUG
SVDIT Resource type definition
SVPIT Resource property definition
SVRIT Resource instance definition
SVSIT Resource - Site Join
TAPHolds parameter values for a task, which is an instantiation of Valid Task,i.e. value for parameter Company Name, etc.
TASHolds instances of Valid Task. Examples of Valid Tasks would be reports, imports, etc. Valid TaskParameters indicate what parameters can be assassigned to an instance of a task, i.e
TDVUsed by event manager/data objects, joins data objects, types of service, and events
TLGKeeps logof SQL transactions.
TMPIndicates which tasks are in a process. Tasks are defined in table; this way, one task can be in many processes.
TODTo do list settings table.
TOSHolds information about a process
TSAStores initialization params (name/value pairs) forscheduler tasks
TSKScheduler task definition information
UDPUser-defined field table
UGPDefines a group of users
UHDUser Policy Profile History Details table
ULNThis table hold UHD allow / deny list
UNM"UnDoMilestone" Feature
UPA
UPA_FIELDSStores changes only for user profile audit history in de-normalized format
UPA_GRP_MEMBERSHIPStores groups membership history in de-normalized format
UPA_RESOURCEStores user profile resource history in de-normalized format
UPA_USRStores user profile history in de-normalized format
UPDUser Policy Profile Details table
UPHUser Policy Profile History table
UPLUser-defined field table
UPPUser Policy Profile table
UPTUser-defined field table
UPYJoins Properties (PTY) and User (USR) tables.
USGThis table stores which users are in which groups.
USRStores all information regarding a user.
UWPWindow sequence, nesting in CarrierBase explorer for each user group.
VTKDefines automation task types such as reports, imports, and exports.
VTPValid Task Parameters. Indicates which parameters can be defined for an instance of a task.
WINWindows table: Windows keys, descriptions, and class names.
XSDThis table holds Xellerate System Data



Reference: Oracle DD

Thursday, May 22, 2008

AD SSL Handshake / Certificate Expired Error

If you have a certificate in Active Directory that is manually generated and expired, your OIM connection might fail with SSL Handshake error or Certificate Expired Error. Even though you see the correct certificate in Active Directory, still you might recieve SSL Handshake Errors or Certificate Expired Errors. This happens mostly when its a manually generated certificate.

Here is the error that you might face:
java.security.cert.CertificateExpiredException: NotAfter: Thu Apr 17 13:56:25 EDT 2008
at sun.security.x509.CertificateValidity.valid(CertificateValidity.java:268)
at sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:564)
at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:123)
at sun.security.validator.Validator.validate(Validator.java:202)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA12275)
at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA12275)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
at com.sun.jndi.ldap.Connection.run(Connection.java:784)

Alternatively, you might face the following issue:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found

Here is the solution for this:

WORKAROUND

To work around this issue, remove the expired (archived) certificate. To do this, follow these steps:1. Open the Microsoft Management Console (MMC) snap-in where you manage the certificate store on the IAS server. If you do not already have an MMC snap-in to view the certificate store from, create one. To do so:a. Click Start, click Run, type mmc in the Open box, and then click OK.
b. On the Console menu (the File menu in Windows Server 2003), click Add/Remove Snap-in, and then click Add.
c. In the Available Standalone Snap-ins list, click Certificates, click Add, click Computer account, click Next, and then click Finish.

Note You can also add the Certificates snap-in for the user account and for the service account to this MMC snap-in.
d. Click Close, and then click OK.

2. Under Console Root, click Certificates (Local Computer).
3. On the View menu, click Options.
4. Click to select the Archived certificates check box, and then click OK.
5. Expand Personal, and then click Certificates.
6. Right-click the expired (archived) digital certificate, click Delete, and then click Yes to confirm the removal of the expired certificate.
7. Quit the MMC snap-in. You do not have to restart the computer or any services to complete this procedure.
8. FYI - In our case, we had to restart the AD server to take the changes in effect. This did not fix the issue without restarting.

This is an excerpt from Microsoft's Website. Here are the links to solve this:

http://support.microsoft.com/kb/822406/

http://support.microsoft.com/kb/839514/

The other problem could be your new / renewed certificate was not imported in Java cacerts keystore of OIM server. Use the following to connect OIM with SSL based Active Directory. This is an excerpt from OIM documentation:

Installing Certificate Services

The connector requires Certificate Services to be running on the host computer. To install Certificate Services:
1.Insert the operating system installation media into the CD-ROM or DVD drive.
2.Click Start, Settings, and Control Panel.
3.Double-click Add/Remove Programs.
4.Click Add/Remove Windows Components.
5.Select Certificate Services.
6.Follow the instructions to start Certificate Services.

Enabling LDAPS

The target Microsoft Active Directory server must have LDAP over SSL (LDAPS) enabled. To enable LDAPS, generate a certificate as follows:
1.On the Active Directory Users and Computers console, right-click the domain node, and select Properties.
2.Click the Group Policy tab.
3.Select Default Domain Policy.
4.Click Edit.
5.Click Computer Configuration, Windows Settings, Security Settings, and Public Key Policies.
6.Right-click Automatic Certificate Request Settings, and then select New and Automatic Certificate Request. A wizard is started.
7.Use the wizard to add a policy with the Domain Controller template.
At the end of this procedure, the certificate is created and LDAP is enabled using SSL on port 636.


Setting Up the Microsoft Active Directory Certificate As a Trusted Certificate

If the Microsoft Active Directory certificate is not issued or certified by a certification authority (CA), then set it up as a trusted certificate. To do this, you first export the certificate and then import it into the keystore of the Oracle Identity Manager server as a trusted CA certificate.
Exporting the Microsoft Active Directory Certificate
To export the Microsoft Active Directory certificate:
1.Click Start, Programs, Administrative Tools, and Certification Authority.
2.Right-click the Certification Authority that you create, and then select Properties.
3.On the General tab, click View Certificate.
4.On the Details tab, click Copy To File.
5.Use the wizard to create a certificate (.cer) file using base-64 encoding.
Importing the Microsoft Active Directory Certificate
To import the Microsoft Active Directory certificate into the certificate store of the Oracle Identity Manager server:

Note:
In a clustered environment, you must perform this procedure on all the nodes of the cluster.

Note:
The user password cannot be set unless 128-bit SSL is used. In addition, the computer on which Microsoft Active Directory is installed must have Microsoft Windows 2000 Service Pack 2 (or later) or Microsoft Windows 2003 running on it.

Wednesday, May 7, 2008

Converting AD long dates to Java Date format

Environment : OIM 9.0.3, OIM Connector Pack 9.0.4.1, AD 2000

When you reconcile data from AD, the AD dates fail to link up OIM dates because of different format. The dates are stored in AD in long format and OIM uses normal Java Dates. So, here is the code that you can use to make this conversion.

import java.util.Date;
import java.util.TimeZone;
import java.text.SimpleDateFormat;
public class AD
{
public void converADdateToOIMdate(long ADdate){

long ADdate = Long.parseLong(String.valueOf(ADdate));
System.out.println("long value : "+ADdate);

// Filetime Epoch is 01 January, 1601
// java date Epoch is 01 January, 1970
// so take the number and subtract java Epoch:
long javaTime = ADdate - 0x19db1ded53e8000L;

// convert UNITS from (100 nano-seconds) to (milliseconds)
javaTime /= 10000;

// Date(long date)
// Allocates a Date object and initializes it to represent
// the specified number of milliseconds since the standard base
// time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
Date theDate = new Date(javaTime);


System.out.println("java DATE value : "+theDate);

SimpleDateFormat formatter = new SimpleDateFormat("MMMMM d, yyyy");
// change to GMT time:
//formatter .setTimeZone(TimeZone.getTimeZone("GMT"));

String newDateString = formatter.format(theDate);

System.out.println("Date changed format :" + newDateString);
}


public static void main(String[] args)
{
AD d=new AD();
d.converADdateToOIMdate(128568528000000000L);
// 9223372036854775807
// 127948319499226601

}
}

Friday, April 25, 2008

Importing Connector XML more than once

Sometimes there is a need to duplicate a resource object, IT Resource, Process Definitions, Forms, Adapters etc. So, the easiest way to do this to reimport the out of the box connector xml or export the connector xml from your environment if you have customizations on the connector. The following example lists the minimal changes that need to be done in order for this xml to be reimported successfully. I am using Unix SSH Connector to demonstrate what changes need to be done.

Firstly, backup your OIM database. Even if you are on a VMWare, remember, Database export is always good.

Next, get a free tool like "xml notepad" from Microsoft or any other xml editor tool.

Open the xml with the editor and do the following:

1. Replace All the "SSH User" to "Linux02" (or choose whatever name you want).

2. Go to the Form Name node and replace it from "UD_SSH" to "UD_L02".

3. Delete objectDataDefinition node.

4. Just import and its all done.

5. Occasionally, if the import fails, do a reimport again. Delete the nodes from the selections in deployment manager which are already in the OIM from the first import (They come with a big X mark on the side).

Monday, March 31, 2008

Problem with AD Connector updating City, State with literal text

The Problem:
When a user is created in AD (using out of the box OIM connector 9041), all values for city, state etc change in AD to be literally "city", "state" etc. instead of correct values supplied via AD User Provisioning form (even with prepop).

The Resolution:
There is a task in AD called Set Exchange Related Properties in Exchange Provisioning Definition. This task has a literal value for all the AD fields like "city", "state". Either make this task conditional or map these values from Xellerate User City / State UDFs.

Thursday, March 20, 2008

Getting your definitions straight

Reconciliation

Reconciliation involves duplicating in Oracle Identity Manager the creation of and modifications to user accounts on the target system. It is an automated process initiated by a scheduled task that you configure.

Types of Reconciliation
While configuring the connector, the target system can be designated as a Trusted Source or Target Resource (also known as Non-Trusted Source). Usually there is a parameter on your Scheduled Task (for eg., IsTrusted = True or False or something like TrustedSource=True or False) that differentiates or tells OIM how to consider the events associated with this scheduled job recon.


  • Trusted Reconciliation
    If you designate the target system as a trusted source, then both newly created and modified user accounts are reconciled in Oracle Identity Manager.

  • Non-Trusted Reconciliation
    If you designate the target system as a target resource or Non-Trusted Source, then only modified user accounts are reconciled in Oracle Identity Manager.


Provisioning

Provisioning involves creating or modifying a user's access rights on the target system through Oracle Identity Manager. You use the Oracle Identity Manager Administrative and User Console to perform provisioning operations.

Wednesday, March 19, 2008

AD Child Domain Referral Searches

If your ldp tool fails to find users / groups from other child / brother domains due to referral issues, use the following method to override the search criteria.

First create an account with Enterprise Admin rights over the full root domain. Once the rights are properly given, in ldp tool, set connection options to add LDAP_OPT_REFERRALS to 1 (after binding with this enterprise admin user) and then retry your search.

Add cross reference of trusted domain. You may use the following Microsoft support link as a reference:
http://support.microsoft.com/kb/241737

If you are coding, add this statement to make it work:
env.put( Context.REFERRAL, "follow" );

Here is the sample code:

import javax.naming.ldap.*;
import javax.naming.directory.*;
import javax.naming.*;
import javax.naming.directory.BasicAttributes;
import java.util.Properties;

public class test {
public static void main(String[] args) {

Properties env = new Properties();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.REFERRAL, "follow" );
env.put(Context.SECURITY_PRINCIPAL, "Rajnish");
env.put(Context.SECURITY_CREDENTIALS, "Bhatia01");

try {
LdapContext context = new InitialLdapContext(env, null);
String base = "DC=nj,DC=bhatiacorp,DC=com";
String filter = "(&(objectClass=group)(CN=rajadmin))";

SearchControls controls = new SearchControls();

String []strReturningAttr = {"member"};

controls.setReturningAttributes(strReturningAttr);
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);

NamingEnumeration answer = context.search(base, filter, controls);
int totalResults = 0;
String strMember ;
BasicAttributes userattrs;

// ... process attributes ...
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();

System.out.println(">>>" + sr.getName());

//Print out the groups

Attributes attrs = sr.getAttributes();

if (attrs != null) {

try {
for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("Attribute: " + attr.getID());
for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {

strMember = (String) e.next();
System.out.println(" " + totalResults + ". " + strMember);
userattrs = (BasicAttributes)context.getAttributes(strMember);


}

}

}
catch (NamingException e) {
System.err.println("Problem listing membership: " + e);
}

}
}
System.out.println("TotalResults " + totalResults );
}
catch (NamingException e) {
System.out.println("Problem retrieving RootDSE: " + e);
}
}
}

Monday, March 17, 2008

Custom Sybase Connector for Non-Supported Versions

import java.sql.*; // JDBC
import com.sybase.jdbc2.*; // Sybase jConnect
import java.util.Properties; // Properties

public class ExtendedUserUtilities {
private static Connection getSybaseConnection( String machine,String port, String userID,String password ) {

Connection connection;
String url;
Properties properties;
connection = null;
url = "jdbc:sybase:Tds:" + machine + ":" + port;
properties = new Properties();
properties.put ( "user", userID );
properties.put ( "password", password );
try {
Class.forName ( "com.sybase.jdbc2.jdbc.SybDriver" ).newInstance();
connection = DriverManager.getConnection( url, properties );
connection.setAutoCommit( false ) ;
}
catch ( Exception exception ) {
System.out.println ( "Error: " + exception.getMessage() );
exception.printStackTrace();
}
System.out.println ( "Connection url: '" + url + "'" );
return connection;

}

public static void main(String[] args){
ExtendedUserUtilities e=new ExtendedUserUtilities("192.168.2.10", "3083", "bhatia_su", "bhatia123");
String Pwd = "Password";
String User = "bhatia01";
e.sybase_adduser(User, pwd,"cp", "g_cp", "Rajnish", "Bhatia");
// e.sybase_dropuser(User);
}

public String sybase_adduser(String user, String password, String database, String group, String firstname, String lastname){
String rtnval="Success";
Connection connection1 = getSybaseConnection( SybaseServer, Port, Admin, Pwd);
if ( connection1 != null ) {
System.out.println( "Connection to Sybase successful" );
} else {
System.out.println( "Connection to Sybase failed" );
}
try {

CallableStatement proc = connection1.prepareCall("{call sp_addlogin( ?, ?, ?, ?, ?) }");
connection1.setAutoCommit(true);
proc.setString( 1, user);
proc.setString( 2, password);
proc.setString( 3, database);
proc.setString( 4, null);
proc.setString( 5, firstname+" "+lastname);
proc.executeUpdate();
System.out.println( "Executed sp_addlogin : User "+user +" created with password " );

CallableStatement proc2 = connection1.prepareCall("{call "+database+".dbo.sp_adduser( ?, ? , ?) }");
proc2.setString( 1, user);
proc2.setString( 2, user);
proc2.setString( 3, group);
proc2.executeUpdate();
System.out.println( "Executed sp_adduser : User "+user +" added." );

} catch( Throwable e ) {
rtnval="Error";
e.printStackTrace();
}
return rtnval;
}

public String sybase_dropuser(String user){
String rtnval="Success";
Connection connection1 = getSybaseConnection( SybaseServer, Port, Admin, Pwd);
if ( connection1 != null ) {
System.out.println( "Connection to Sybase successful" );
} else {
System.out.println( "Connection to Sybase failed" );
}
try {

CallableStatement proc = connection1.prepareCall("{call databasename.dbo.sp_dropuser( ?) }");
connection1.setAutoCommit(true);
proc.setString( 1, user);

proc.executeUpdate();
System.out.println( "Executed sp_dropuser : User "+user +" dropped" );

CallableStatement proc2 = connection1.prepareCall("{call sp_droplogin( ?) }");
proc2.setString( 1, user);
proc2.executeUpdate();
System.out.println( "Executed sp_droplogin : User "+user +" dropped." );

} catch( Throwable e ) {
rtnval="Error";
e.printStackTrace();
}
return rtnval;
}
}

Add jconn2.jar Sybase driver to this code.

AD Move User to New OU

The Active Directory Connector by default creates users in CN=Users. Oftentimes, you need to move user to another ou based on some logic, for example based of location. So, here I present you with a code snippet that you can use to move user to another ou and attach it to create user "Success" response code in AD Provisioining process.

import javax.naming.*;
import javax.naming.directory.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import Thor.API.Exceptions.tcAPIException;
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import Thor.API.Base.tcUtilityOperationsIntf;
import Thor.API.Operations.tcUserOperationsIntf;

import com.thortech.util.logging.Logger;
import java.util.Hashtable;
public class MoveUserToOU {
public Logger logger;

public String MoveUser2NewOU(String cn, String ADServer, String domain,String Location, String AdminID, String Password){
String rtnval="EXECUTION_SUCCESS";
if (Location.equalsIgnoreCase(""))
{
return rtnval;
}
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_PROTOCOL, "ssl");
env.put(Context.PROVIDER_URL, "ldaps://"+ADServer+":636/");
//AdminID="Administrator@bhatia.com"
env.put(Context.SECURITY_PRINCIPAL, AdminID);
//Password="Password1";
env.put(Context.SECURITY_CREDENTIALS, Password);
try {
DirContext ctx = new InitialDirContext(env);
String OldCN="CN="+cn+",OU=Users,OU=OTHR,"+domain;
logger.debug("Old CN:"+OldCN);
String NewCN="CN="+cn+",OU=Users,OU="+getNewOU(Location)+","+domain;
logger.debug("New CN:"+NewCN);
logger.debug("Starting Modify DN ");
ctx.rename(OldCN, NewCN);
logger.debug("Ended Modify DN with Success..."+rtnval);
//ctx.rename("CN=Rajnish Bhatia,OU=HR,dc=bhatia,dc=com", "CN=Rajnish Bhatia,OU=IT,dc=bhatia,dc=com");
//System.out.println(ctx.lookup("CN=Rajnish Bhatia,OU=IT,dc=bhatia,dc=com"));
ctx.close();
} catch (Exception e) {
logger.debug("Ended Modify DN with Error...");
rtnval="ERROR : "+e.getMessage();
e.printStackTrace();
}
return rtnval;
}

public String getNewOU(String Location) {
String NewOU="";
if(Location.equalsIgnoreCase("CA"))
NewOU="CA";
else
if(Location.equalsIgnoreCase("TN"))
NewOU="TN";
else
if(Location.equalsIgnoreCase("NJ"))
NewOU="NJ";
else
if(Location.equalsIgnoreCase("TX"))
NewOU="TX";
return NewOU;
}
}

Active Directory SSL Test

You may use this code to test the SSL connection with your AD server.

=====================================================
ADSSLConnectionTest.java
=====================================================

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class ADSSLConnectionTest
{

private DirContext getContext(String ldaphost, String ldapport, String adminID, String adminpassword, boolean useSSL)
{
DirContext ctx=null;
String providerurl=ldaphost+":"+ldapport;
if(ldapport=="")
{
ldapport="636";
}
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY ,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL ,providerurl);
if(useSSL==true)
{
// if SSL is used - use can use ssl enabled ldaphost
// eg. "ldaps://localhost:636"
// else
// eg. "ldap://localhost:636"
env.put(Context.SECURITY_PROTOCOL, "ssl");
}
env.put(Context.SECURITY_AUTHENTICATION ,"simple");
env.put(Context.SECURITY_PRINCIPAL ,adminID);
env.put(Context.SECURITY_CREDENTIALS ,adminpassword);
ctx = new InitialDirContext(env);
}
catch(Exception ex)
{
ex.printStackTrace();
}
return ctx;
}

public DirContext getContext()
{
DirContext ctx=null;
try {
ctx=getContext("ldaps://localhost","636","CN=Rajnish Bhatia,DC=bhatia,DC=com","Password1",true);
System.out.println("Connected with SSL");
}
catch(Exception ex)
{
System.out.println("NOT Connected with SSL");
ex.printStackTrace();
}
return ctx;
}

public static void main(String[] args) {
try
{
ADSSLConnectionTest c = new ADSSLConnectionTest();
c.getContext();
}catch(Exception ex)
{
ex.printStackTrace();
}
}
}

Compile and run with your credentials as following:

C:\>javac ADSSLConnectionTest.java

C:\>java ADSSLConnectionTest

=============================
Notes
=============================

1. If you have issues, make sure your SSL Certificate is in proper java store such as C:\j2sdk1.4.2_13\jre\lib\security. Make sure you are adding the certificate to the correct (& in path) java cacerts keystore.

2. You may also test by telnet to the server - telnet localhost 636

3. You may list the keystore values as follows:
C:\j2sdk1.4.2_13\jre\lib\security>keytool -list -v -storepass changeit -keystore cacerts

This is how it looks:


*******************************************
*******************************************


Alias name: someclass3g3ca
Creation date: Jun 15, 2004
Entry type: trustedCertEntry

Owner: CN=Some Authority, OU="(c)
1999 Bhatia, Inc. - For authorized use only", OU=Bhatia Trust Network, O="Bhatia, Inc.", C=US
Issuer: CN=Some Authority, OU="(c)
1999 Bhatia, Inc. - For authorized use only", OU=Bhatia Trust Network, O="Bhatia, Inc.", C=US
Serial number: 9b7e0649a33e62b9d5ee90487129ef53
Valid from: Thu Sep 30 20:00:00 EDT 1999 until: Wed Jul 16 19:59:59 EDT 2036
Certificate fingerprints:
MD5: CD:68:B6:A7:C7:C4:CE:75:E0:1D:2F:57:44:61:92:09
SHA1: 13:2D:0D:45:53:4B:69:97:CD:B2:D6:C3:39:E2:55:76:60:9B:5C:C6


*******************************************
*******************************************

Alias name: corp9
Creation date: Mar 17, 2008
Entry type: trustedCertEntry

Owner: CN=srvr-corp9.nj.bhatia.com
Issuer: CN=SRVR-RAS-DC, DC=bhatia, DC=com
Serial number: 2714a16c000000000013
Valid from: Mon Jan 28 12:14:58 CST 2008 until: Tue Jan 27 12:14:58 CST 2009
Certificate fingerprints:
MD5: CD:48:B6:A7:C7:C4:CE:75:E0:1D:2F:57:44:61:92:09
SHA1: 12:1D:0D:45:52:4B:64:97:CD:B2:D6:C3:39:E2:55:76:60:9B:5C:C6


*******************************************
*******************************************

4. Then, make sure your ADITResource in OIM - The server is srvr-corp9.nj.bhatia.com (as per your keystore).

5. For specific ldap error codes, look at the following url:
http://www.directory-info.com/LDAP/LDAPErrorCodes.html