@Override public void addLast(Interceptor interceptor) throws LdapException { wrapped.addLast(interceptor); }
ds.addLast(new KeyDerivationInterceptor());
ds.addLast(new KeyDerivationInterceptor());
ds.addLast(new KeyDerivationInterceptor());
/** Starts the LDAP Server with SASL enabled. */ private void startLdap() throws Exception { // Create and start LDAP server. ldapServer = new LdapServer(); // Enable SASL layer, this is useful with or without kerberos. Map<String, MechanismHandler> mechanismHandlerMap = Maps.newHashMap(); mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler()); mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, new CramMd5MechanismHandler()); mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, new DigestMd5MechanismHandler()); // GSSAPI is required for kerberos. mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler()); ldapServer.setSaslMechanismHandlers(mechanismHandlerMap); ldapServer.setSaslHost(hostname); // Realms only used by DIGEST_MD5 and GSSAPI. ldapServer.setSaslRealms(Collections.singletonList(realm)); ldapServer.setSearchBaseDn(dn); ldapPort = ldapPort != -1 ? ldapPort : findAvailablePort(10389); ldapServer.setTransports(new TcpTransport(address.getHostAddress(), ldapPort)); ldapServer.setDirectoryService(service); if (kerberos) { // Add an interceptor to attach krb5keys to created principals. KeyDerivationInterceptor interceptor = new KeyDerivationInterceptor(); interceptor.init(service); service.addLast(interceptor); } ldapServer.start(); }
ds.addLast(new KeyDerivationInterceptor());
private ApacheDS startDirectoryService(String workDirStr) throws Exception { DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory(); factory.init(realm); directoryService = factory.getDirectoryService(); directoryService.getChangeLog().setEnabled(false); directoryService.setShutdownHookEnabled(false); directoryService.setAllowAnonymousAccess(true); File workDir = new File(workDirStr); if (workDir.exists()) { FileUtils.deleteDirectory(workDir); } InstanceLayout instanceLayout = new InstanceLayout(workDir); directoryService.setInstanceLayout(instanceLayout); AvlPartition partition = new AvlPartition(directoryService.getSchemaManager()); partition.setId("Test"); partition.setSuffixDn(new Dn(directoryService.getSchemaManager(), baseDn)); partition.addIndexedAttributes( new AvlIndex<>("ou"), new AvlIndex<>("uid"), new AvlIndex<>("dc"), new AvlIndex<>("objectClass")); partition.initialize(); directoryService.addPartition(partition); directoryService.addLast(new KeyDerivationInterceptor()); directoryService.shutdown(); directoryService.startup(); return this; }
service.addLast( ( Interceptor ) interceptorClass.newInstance() );