本文整理汇总了Java中org.subethamail.smtp.AuthenticationHandlerFactory.getAuthenticationMechanisms方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationHandlerFactory.getAuthenticationMechanisms方法的具体用法?Java AuthenticationHandlerFactory.getAuthenticationMechanisms怎么用?Java AuthenticationHandlerFactory.getAuthenticationMechanisms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.subethamail.smtp.AuthenticationHandlerFactory
的用法示例。
在下文中一共展示了AuthenticationHandlerFactory.getAuthenticationMechanisms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFactory
import org.subethamail.smtp.AuthenticationHandlerFactory; //导入方法依赖的package包/类
/** */
public void addFactory(AuthenticationHandlerFactory fact)
{
List<String> partialMechanisms = fact.getAuthenticationMechanisms();
for (String mechanism: partialMechanisms)
{
if (!this.mechanisms.contains(mechanism))
{
this.mechanisms.add(mechanism);
this.plugins.put(mechanism, fact);
}
}
}
示例2: execute
import org.subethamail.smtp.AuthenticationHandlerFactory; //导入方法依赖的package包/类
/** */
@Override
public void execute(String commandString, Session sess) throws IOException
{
String[] args = this.getArgs(commandString);
if (args.length < 2)
{
sess.sendResponse("501 Syntax: EHLO hostname");
return;
}
sess.resetMailTransaction();
sess.setHelo(args[1]);
// postfix returns...
// 250-server.host.name
// 250-PIPELINING
// 250-SIZE 10240000
// 250-ETRN
// 250 8BITMIME
// Once upon a time this code tracked whether or not HELO/EHLO has been seen
// already and gave an error msg. However, this is stupid and pointless.
// Postfix doesn't care, so we won't either. If you want more, read:
// http://homepages.tesco.net/J.deBoynePollard/FGA/smtp-avoid-helo.html
StringBuilder response = new StringBuilder();
response.append("250-");
response.append(sess.getServer().getHostName());
response.append("\r\n" + "250-8BITMIME");
int maxSize = sess.getServer().getMaxMessageSize();
if (maxSize > 0)
{
response.append("\r\n" + "250-SIZE ");
response.append(maxSize);
}
// Enabling / Hiding TLS is a server setting
if (sess.getServer().getEnableTLS() && !sess.getServer().getHideTLS())
{
response.append("\r\n" + "250-STARTTLS");
}
// Check to see if we support authentication
AuthenticationHandlerFactory authFact = sess.getServer().getAuthenticationHandlerFactory();
if (authFact != null)
{
List<String> supportedMechanisms = authFact.getAuthenticationMechanisms();
if (!supportedMechanisms.isEmpty())
{
response.append("\r\n" + "250-" + AuthCommand.VERB + " ");
response.append(TextUtils.joinTogether(supportedMechanisms, " "));
}
}
response.append("\r\n" + "250 Ok");
sess.sendResponse(response.toString());
}