当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationHandlerFactory.getAuthenticationMechanisms方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:14,代码来源:MultipleAuthenticationHandlerFactory.java

示例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());
	}
 
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:62,代码来源:EhloCommand.java


注:本文中的org.subethamail.smtp.AuthenticationHandlerFactory.getAuthenticationMechanisms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。