1. Create an LDIF file with the new attribute extensions using a text editor.
    dn: cn=schema 
    objectClass: top 
    objectClass: ldapSubentry 
    objectClass: subschema 
    attributeTypes: ( contractorStatus-OID NAME 'contractorStatus'
      EQUALITY booleanMatch 
      USAGE userApplications 
      X-ORIGIN 'Directory Server Example' )
    attributeTypes: ( contractorAgency-OID NAME 'contractorAgency' 
      EQUALITY caseIgnoreMatch 
      SUBSTR caseIgnoreSubstringsMatch 
      USAGE userApplications 
      X-ORIGIN 'PingDirectory Server Example' )
  2. In the same LDIF file, add a new object class definition after the attribute types. In this example, create an auxiliary object class, contractor, that alone cannot be used as an entry. The object class will be used to add supplemental information to the inetOrgPerson structural object class. The attributes are all optional for the new object class.
    objectClasses: ( contractor-OID 
      NAME 'contractor' 
      DESC 'Contractor status information' 
      SUP top 
      MAY ( contractorStatus $ contractorAgency ) 
      X-ORIGIN 'PingDirectory Server Example' )
  3. Save the file as 99-auxobjclass.ldif. and place it in the <server-root>/config/schema directory.
  4. At this stage, the schema extensions are not loaded into the Directory Server yet. You have four options to load them:
    • Create a task that loads the new extensions into the schema. We create a task labelled with the ID "add-schema-99-auxobjclass" and add it using ldapmodify. The server does not need to be restarted using this method.
      dn: ds-task-id=add-schema-99-auxobjclass,cn=Scheduled Tasks,cn=tasks 
      objectClass: top 
      objectClass: ds-task 
      objectClass: ds-task-add-schema-file
      ds-task-id: add-schema-99-auxobjclass 
      ds-task-class-name: com.unboundid.directory.server.tasks.AddSchemaFileTask 
      ds-task-schema-file-name: 99-auxobjclass.ldif
    • Import the schema file using the Administrative Console Schema Editor. You do not need to restart the server when using this method.
    • Place the 99-auxobjclass.ldif file in the <server-root>/config/schema directory and restart the Directory Server. The schema file is read at startup.
    • Add the schema file using load-ldap-schema-file. You do not need to restart the server when using this method.
      $ bin/load-ldap-schema-file --schemaFile config/schema 99-auxobjclass.ldif
  5. Verify the addition by displaying the attribute using ldapsearch.
    $ bin/ldapsearch --baseDN dc=example,dc=com "(uid=user.9)" contractorStatus
    dn: uid=user.9,ou=People,dc=example,dc=com 
    contractorStatus: TRUE