Java源码示例:org.apache.directory.server.ldap.handlers.sasl.plain.PlainMechanismHandler

示例1
@Override
protected LdapServer createLdapServer() {
    LdapServer ldapServer = super.createLdapServer();

    ldapServer.setSaslHost(this.bindHost);
    ldapServer.setSaslPrincipal( this.ldapSaslPrincipal);
    ldapServer.setSaslRealms(new ArrayList<String>());

    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.CRAM_MD5, new CramMd5MechanismHandler());
    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.DIGEST_MD5, new DigestMd5MechanismHandler());
    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler());
    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.NTLM, new NtlmMechanismHandler());
    ldapServer.addSaslMechanismHandler(SupportedSaslMechanisms.GSS_SPNEGO, new NtlmMechanismHandler());

    return ldapServer;
}