use of org.apache.directory.api.ldap.model.name.Rdn in project aws-iam-ldap-bridge by denismo.
the class Runner method createStructure.
public void createStructure() throws Exception {
String rootDN = AWSIAMAuthenticator.getConfig().rootDN;
Dn dnIAM = service.getDnFactory().create(rootDN);
if (!utils.exists(dnIAM)) {
IAM_LOG.info("Creating partition " + rootDN);
Partition iamPartition = utils.addPartition("iam", rootDN, service.getDnFactory());
// Index some attributes on the apache partition
utils.addIndex(iamPartition, "objectClass", "ou", "uid", "gidNumber", "uidNumber", "cn");
if (!utils.exists(dnIAM)) {
IAM_LOG.info("Creating root node " + rootDN);
Rdn rdn = dnIAM.getRdn(0);
Entry entryIAM = new DefaultEntry(service.getSchemaManager(), dnIAM, "objectClass: top", "objectClass: domain", "entryCsn: " + service.getCSN(), SchemaConstants.ENTRY_UUID_AT + ": " + UUID.randomUUID().toString(), rdn.getType() + ": " + rdn.getValue());
service.getAdminSession().add(entryIAM);
checkErrors();
}
}
service.sync();
}
use of org.apache.directory.api.ldap.model.name.Rdn in project aws-iam-ldap-bridge by denismo.
the class LDAPIAMPoller method createEntry.
private void createEntry(String dn, String clazz) throws LdapException {
Dn dnObj = directory.getDnFactory().create(dn);
Rdn rdn = dnObj.getRdn(0);
DefaultEntry entry = new DefaultEntry(directory.getSchemaManager(), dn);
entry.put(rdn.getType(), rdn.getValue());
entry.put(SchemaConstants.ENTRY_CSN_AT, directory.getCSN().toString());
entry.put(SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString());
entry.put("objectclass", clazz);
add(entry);
}
Aggregations