I discussed about Attribute and Object Class in Oracle Internet Directory (OID) in my previous post here . OID comes with default attributes and objects classes and provides mechanism (Graphical User Interface – GUI and Command Line Interface – CLI) to add attributes and objects classes (Process of adding attributes and object classes is also known as OID Schema Extension)
In this post I am going to show how to add attributes and object class both from CLI and GUI.
First some theory :
1. ODSM more here, is a Graphical Tool to create/view/manage Attributes/Object Classes (Select tab Schema & then select Attributes or Object Classes)
2. OID schema is stored under cn=subschemasubentry at Root DSE (Directory Server Entry)
3. To read schema definition (list of defined attributes, object classes) run
ldapsearch -h [host] -p [port] -b “cn=subschemasubentry” -s base “objectclass=*” (where host is OID server and Port is OID port)
4. Use ldapmodify (LDAP command) to define new attribute/object class
.
.
How to add attribute from GUI ?
1. Login to ODSM http://server:port/odsm(where server is hostname of machine where ODSM/WebLogic wls_ods1 managed server is running and port is wls_ods1 managed server port i.e. 7005)
2. Select tab Schema
3. Click on Attributes or Object Classes
4. Click on Add button
.
.
How to add attribute from CLI ?
1.Create a ldif file with list of all attributes and object classes like
_________________________
dn: cn=subschemasubentry
changetype: modify
add: attributetypes
attributetypes: ( 99.99.99.99.01 NAME ‘attribute1’ DESC ‘Custom Attribute 1’ EQUALITY caseIgnoreMatch SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’ )
dn: cn=subschemasubentry
changetype: modify
add: attributetypes
attributetypes: ( 99.99.99.99.02 NAME ‘attribute2’ DESC ‘Custom Attribute 2’ EQUALITY caseIgnoreMatch SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’ )
dn: cn=subschemasubentry
changetype: modify
add: objectClasses
objectClassess: ( 99.99.99.99.03 NAME ‘class1’ DESC ‘custom object class 1’ SUP top STRUCTURAL MUST cn MAY ( Attribute1 $ Attribute2 ) )
dn: cn=subschemasubentry
changetype: modify
add: objectClasses
objectClassess: ( 99.99.99.99.04 NAME ‘class2’ DESC ‘custom object class 2’ SUP top AUXILIARY MAY ( Attribute1 $ Attribute2 ) )
_________________
Lets understand what is in above LDIF file
a) I am creating two attributes and two object classes using LDIF file above .
B) Each attribute/object class is separated by blank line (You will hit error if you don’t leave blank line between two attributes/object classes)
c) Number 99.99.99.99.0X represents Object Identifier which is unique number
d) attribute1/2, class1/2 represents name of attribute or object class
e) EQUALITY caseIgnoreMatch represents that attribute is case insensitive
f) SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’ represents that attribute is of type Directory String . Other option for SYNTAX are Binary, Boolean, Certificate, Audio…
g) SUP top in object class represents that Super class for particular Object class is top (top is object class of OID)
h) STRUCTURAL (objectclass1), AUXILIARY (objectclass2) represents object class type (In total Object Class are of three type STRUCTURAL, AUXILIARY and ABSTRACT )
i) MUST represents mandatory attributes and MAY represents optional attributes.
j) Multiple attributes are added by putting then between ( ) and $ as seperator
2. Next step after creating LDIF file is to load this file in OID using
$ORACLE_HOME/bin/ldapadd -h [OID_Host] -p [OID_Port] -D “cn=orcladmin” -w [orcladmin_password] -f [name_of_LDIF_file] (Where ORACLE_HOME is set to OID ORACLE_HOME)
3. Above step will create attribute and object class in OID , next step is to add indexes to attributes loaded above (Attribute with Indexes are search-able)
$ORACLE_HOME/ldap/bin/catalog connect=oiddb add=TRUE attribute=[name_of_attribute] verbose=TRUE (Where ORACLE_HOME is set to OID ORACLE_HOME. Make sure ORACLE_INSTANCE is set to OID instance)
.
References