Create a custom schema / add to the existing schema for the LDAP server UnboundID

I am trying to duplicate the LDAP mockup / schema from the field the application should be running to - and I am trying to recreate + test it using an automated test with the Embedded LDAP UnboundID server.

The situation he has to deal with is that the userOf property of the user schema, such as Active Directory, has ... but I'm not quite sure how to add the user class to this ldap in memory.

1) Is it possible? 2) Is there a better strategy? 3) And what exactly should I do? I am new to LDAP.

Below is my broken code.

Thank you Mike Cohout

public class TestOpenLdap2
{
    private InMemoryDirectoryServer server;

    @Before
    public void start() throws Exception
    {
        InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig("dc=com");
        config.addAdditionalBindCredentials("cn=admin,ou=People,dc=example,dc=com", "cred");
        InMemoryListenerConfig listenerConfig = new InMemoryListenerConfig("test", null, 33390, null, null, null);
        config.setListenerConfigs(listenerConfig);
        server = new InMemoryDirectoryServer(config);
        server.startListening();
    }

    @Test
    public void testMemberOf() throws Exception
    {

        addEntry("dn: dc=com", "objectClass: top", "objectClass: domain", "dc: com");

        ObjectClassDefinition oc = new ObjectClassDefinition("10.19.19.78", new String[]{"user"}, "", false, new String[]{"TOP"},
                                                                              ObjectClassType.STRUCTURAL, new String[]{"memberOf"},
                                                                              new String[]{}, new HashMap());
        addEntry("dn: cn=schema2,dc=com", "objectClass: top", "objectClass: ldapSubEntry", "objectClass: subschema", "cn: schema2",
                    "objectClasses:  " + oc.toString());

        addEntry("dn: dc=people,dc=com", "objectClass: top", "objectClass: domain", "dc: people");
        addEntry("dn: dc=groups,dc=com", "objectClass: top", "objectClass: domain", "dc: groups");
        addEntry("dn: cn=test-group,dc=groups,dc=com", "objectClass: groupOfUniqueNames", "cn: test group");
        addEntry("dn: cn=Testy Tester,dc=people,dc=com", "objectClass: Person", "objectClass: user", "objectClass: organizationalPerson", "sn: Tester", "cn: Testy Tester", "memberOf: cn=test-group,dc=groups,dc=com");
    }

    public void addEntry(String... args) throws LDIFException, LDAPException
    {
        LDAPResult result = server.add(args);
        assert (result.getResultCode().intValue() == 0);
        System.out.println("added entry:" + Arrays.asList(args));
    }
+5
source share
3

, , , , Neil Wilson, ( , com.unboundid: unboundid-ldapsdk: 2.3.1):)

objectClass , userPrincipalName:

dn: cn=schema
changetype: modify
add: attributetypes
attributetypes: ( 1.2.3.4.5.6.7 NAME 'userPrincipalName' DESC 'userPrincipalName as per Active Directory' EQUALITY caseIgnoreMatch SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' )

dn: cn=schema
changetype: modify
delete: objectClasses
objectClasses: ( 2.5.6.6
                 NAME 'person'
                 SUP top
                 STRUCTURAL
                 MUST ( sn $
                        cn )
                 MAY ( userPassword $
                       telephoneNumber $
                       seeAlso $
                       description )
                 X-ORIGIN 'RFC 4519' )

dn: cn=schema
changetype: modify
add: objectClasses
objectClasses: ( 2.5.6.6
                 NAME 'person'
                 SUP top
                 STRUCTURAL
                 MUST ( sn $
                        cn $
                        userPrincipalName )
                 MAY ( userPassword $
                       telephoneNumber $
                       seeAlso $
                       description ) )

, objectClass . "objectClasses", . , Neil: docs/standard-schema.ldif

userPrincipalName Oracle, , : http://docs.oracle.com/cd/E12839_01/oid.1111/e10035/ldif_appendix.htm#CHDCCJIG

+5

(.. cn = schema LDAP). , .

, , , , . ( , - , docs/standard-schema.ldif, ).

Neil

+4

LDAP , , Referencial Integrity , LDAP SDK Java

  • DN...

.

Active-Directory , - ADAM ( Active Dirctory Application Mode). Microsoft, AD. ADAM , Windows XP. Windows Seven LDS ( ). AD AD.

0

All Articles