本文整理匯總了Java中org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler類的典型用法代碼示例。如果您正苦於以下問題:Java PlainMechanismHandler類的具體用法?Java PlainMechanismHandler怎麽用?Java PlainMechanismHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PlainMechanismHandler類屬於org.apache.directory.server.ldap.handlers.bind.plain包,在下文中一共展示了PlainMechanismHandler類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startLdapServer
import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler; //導入依賴的package包/類
private ApacheDS startLdapServer() throws Exception {
Preconditions.checkState(directoryService.isStarted());
Preconditions.checkState(!ldapServer.isStarted());
int port = AvailablePortFinder.getNextAvailable(1024);
ldapServer.setTransports(new TcpTransport(port));
ldapServer.setDirectoryService(directoryService);
// Setup SASL mechanisms
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());
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler());
ldapServer.setSaslMechanismHandlers(mechanismHandlerMap);
ldapServer.setSaslHost("localhost");
ldapServer.setSaslRealms(Collections.singletonList(realm));
// TODO ldapServer.setSaslPrincipal();
// The base DN containing users that can be SASL authenticated.
ldapServer.setSearchBaseDn(baseDn);
ldapServer.start();
return this;
}
示例2: setupSaslMechanisms
import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler; //導入依賴的package包/類
/**
* @param server
* The server
*/
private void setupSaslMechanisms(LdapServer server) {
HashMap<String, MechanismHandler> mechanismHandlerMap = new HashMap<String, MechanismHandler>();
mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
CramMd5MechanismHandler cramMd5MechanismHandler = new CramMd5MechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, cramMd5MechanismHandler);
DigestMd5MechanismHandler digestMd5MechanismHandler = new DigestMd5MechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, digestMd5MechanismHandler);
GssapiMechanismHandler gssapiMechanismHandler = new GssapiMechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, gssapiMechanismHandler);
NtlmMechanismHandler ntlmMechanismHandler = new NtlmMechanismHandler();
// TODO - set some sort of default NtlmProvider implementation here
// ntlmMechanismHandler.setNtlmProvider( provider );
// TODO - or set FQCN of some sort of default NtlmProvider implementation here
// ntlmMechanismHandler.setNtlmProviderFqcn( "com.foo.BarNtlmProvider" );
mechanismHandlerMap.put(SupportedSaslMechanisms.NTLM, ntlmMechanismHandler);
mechanismHandlerMap.put(SupportedSaslMechanisms.GSS_SPNEGO, ntlmMechanismHandler);
getLdapServer().setSaslMechanismHandlers(mechanismHandlerMap);
}
示例3: setupSaslMechanisms
import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler; //導入依賴的package包/類
private void setupSaslMechanisms() {
Map<String, MechanismHandler> mechanismHandlerMap = new HashMap<String, MechanismHandler>();
mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
CramMd5MechanismHandler cramMd5MechanismHandler = new CramMd5MechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, cramMd5MechanismHandler);
DigestMd5MechanismHandler digestMd5MechanismHandler = new DigestMd5MechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, digestMd5MechanismHandler);
GssapiMechanismHandler gssapiMechanismHandler = new GssapiMechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, gssapiMechanismHandler);
NtlmMechanismHandler ntlmMechanismHandler = new NtlmMechanismHandler();
mechanismHandlerMap.put(SupportedSaslMechanisms.NTLM, ntlmMechanismHandler);
mechanismHandlerMap.put(SupportedSaslMechanisms.GSS_SPNEGO, ntlmMechanismHandler);
this.ldapServer.setSaslMechanismHandlers(mechanismHandlerMap);
}