本文整理汇总了Java中org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory类的典型用法代码示例。如果您正苦于以下问题:Java EasyAuthenticationHandlerFactory类的具体用法?Java EasyAuthenticationHandlerFactory怎么用?Java EasyAuthenticationHandlerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EasyAuthenticationHandlerFactory类属于org.subethamail.smtp.auth包,在下文中一共展示了EasyAuthenticationHandlerFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startup
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Override
public void startup()
{
serverImpl = new SMTPServer(new HandlerFactory());
// MER - May need to override SMTPServer.createSSLSocket to specify non default keystore.
serverImpl.setPort(getPort());
serverImpl.setHostName(getDomain());
serverImpl.setMaxConnections(getMaxConnections());
serverImpl.setHideTLS(isHideTLS());
serverImpl.setEnableTLS(isEnableTLS());
serverImpl.setRequireTLS(isRequireTLS());
if(isAuthenticate())
{
AuthenticationHandlerFactory authenticationHandler = new EasyAuthenticationHandlerFactory(new AlfrescoLoginUsernamePasswordValidator());
serverImpl.setAuthenticationHandlerFactory(authenticationHandler);
}
serverImpl.start();
log.info("Inbound SMTP Email Server has started successfully, on hostName:" + getDomain() + "port:" + getPort());
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:SubethaEmailServer.java
示例2: shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Test
public void shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly(){
final String username = "username";
final String password = "password";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn(username);
when(authentication.getPassword()).thenReturn(password);
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
ArgumentCaptor<AuthenticationHandlerFactory> argumentCaptor = ArgumentCaptor.forClass(AuthenticationHandlerFactory.class);
verify(smtpServer).setAuthenticationHandlerFactory(argumentCaptor.capture());
AuthenticationHandlerFactory authenticationHandlerFactory = argumentCaptor.getValue();
assertNotNull(authenticationHandlerFactory);
assertThat(authenticationHandlerFactory, instanceOf(EasyAuthenticationHandlerFactory.class));
EasyAuthenticationHandlerFactory easyAuthenticationHandlerFactory = (EasyAuthenticationHandlerFactory)authenticationHandlerFactory;
assertSame(basicUsernamePasswordValidator, easyAuthenticationHandlerFactory.getValidator());
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:24,代码来源:SmtpServerConfiguratorTest.java
示例3: configureAuthentication
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
private void configureAuthentication(SMTPServer smtpServer, FakeSmtpConfigurationProperties.Authentication authentication) {
if (StringUtils.isEmpty(authentication.getUsername())) {
logger.error("Username is missing; skip configuration of authentication");
} else if (StringUtils.isEmpty(authentication.getPassword())) {
logger.error("Password is missing; skip configuration of authentication");
} else {
logger.info("Setup simple username and password authentication for SMTP server");
smtpServer.setAuthenticationHandlerFactory(new EasyAuthenticationHandlerFactory(basicUsernamePasswordValidator));
}
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:11,代码来源:SmtpServerConfigurator.java
示例4: setUp
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
this.wiser = new TestWiser();
this.wiser.setHostname("localhost");
this.wiser.setPort(PORT);
UsernamePasswordValidator validator = new RequiredUsernamePasswordValidator();
EasyAuthenticationHandlerFactory fact = new EasyAuthenticationHandlerFactory(validator);
this.wiser.getServer().setAuthenticationHandlerFactory(fact);
this.wiser.getServer().setRequireAuth(true);
this.wiser.start();
this.c = new Client("localhost", PORT);
}
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:16,代码来源:RequireAuthTest.java
示例5: setUp
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
this.wiser = new TestWiser();
this.wiser.setHostname("localhost");
this.wiser.setPort(PORT);
UsernamePasswordValidator validator = new RequiredUsernamePasswordValidator();
EasyAuthenticationHandlerFactory fact = new EasyAuthenticationHandlerFactory(validator);
this.wiser.getServer().setAuthenticationHandlerFactory(fact);
this.wiser.start();
this.c = new Client("localhost", PORT);
}
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:16,代码来源:AuthTest.java
示例6: SmtpService
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
/**
*
* @param configuration
* @param passwordVerifier
* @param mailSender
* @throws UnknownHostException if the listen address cannot be resolved
*/
public SmtpService(Configuration configuration, PasswordVerifier passwordVerifier, MailSender mailSender) throws UnknownHostException {
super(new HandlerFactory(mailSender));
setBindAddress(InetAddress.getByName(configuration.getSmtpAddress()));
setPort(configuration.getSmtpPort());
setAuthenticationHandlerFactory(new EasyAuthenticationHandlerFactory(new Validator(passwordVerifier)));
setEnableTLS(true);
// Key store for private key and signing certs
System.setProperty("javax.net.ssl.keyStore", configuration.getSSLKeyStoreFile().getAbsolutePath());
System.setProperty("javax.net.ssl.keyStorePassword", configuration.getSSLKeyStorePassword());
}
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:19,代码来源:SmtpService.java
示例7: testSMTPSessionAuthentication
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Test
public void testSMTPSessionAuthentication() throws MessagingException, IOException {
SessionConfig mailConfig = TestMailConfigs.standardConfig();
Person person = new Person(toName, toAddress);
String subject = "HTML+Text Message from Seam Mail - " + java.util.UUID.randomUUID().toString();
Wiser wiser = new Wiser(mailConfig.getServerPort());
wiser.setHostname(mailConfig.getServerHost());
wiser.getServer().setAuthenticationHandlerFactory(new EasyAuthenticationHandlerFactory(new SMTPAuthenticator("test", "test12!")));
try {
wiser.start();
new MailMessageImpl(mailConfig).from(fromAddress).to(person.getEmail()).subject(subject).put("version", "Seam 3").bodyHtmlTextAlt(
new VelocityTemplate(Resources.newInputStreamSupplier(Resources.getResource("template.html.velocity")).getInput()),
new VelocityTemplate(Resources.newInputStreamSupplier(Resources.getResource("template.text.velocity")).getInput())).importance(MessagePriority.LOW).deliveryReceipt(fromAddress)
.readReceipt("seam.test").addAttachment("template.html.velocity", "text/html", ContentDisposition.ATTACHMENT,
Resources.newInputStreamSupplier(Resources.getResource("template.html.velocity")).getInput()).addAttachment(
new URLAttachment("http://design.jboss.org/seam/logo/final/seam_mail_85px.png", "seamLogo.png", ContentDisposition.INLINE)).send();
}
finally {
stop(wiser);
}
Assert.assertTrue("Didn't receive the expected amount of messages. Expected 1 got " + wiser.getMessages().size(), wiser.getMessages().size() == 1);
MimeMessage mess = wiser.getMessages().get(0).getMimeMessage();
Assert.assertEquals("Subject has been modified", subject, MimeUtility.unfold(mess.getHeader("Subject", null)));
EmailMessage convertedMessage = MessageConverter.convert(mess);
Assert.assertEquals(convertedMessage.getSubject(), subject);
}
开发者ID:codylerum,项目名称:simple-email,代码行数:32,代码来源:VelocityMailMessageTest.java
示例8: testSMTPSessionAuthentication
import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; //导入依赖的package包/类
@Test
public void testSMTPSessionAuthentication() throws MessagingException, IOException {
SimpleMailConfig mailConfig = TestMailConfigs.gmailConfig();
String subject = "HTML+Text Message from Seam Mail - " + java.util.UUID.randomUUID().toString();
Person person = new Person(toName, toAddress);
mailConfig.setServerHost("localHost");
mailConfig.setServerPort(8978);
Wiser wiser = new Wiser(mailConfig.getServerPort());
wiser.getServer().setAuthenticationHandlerFactory(new EasyAuthenticationHandlerFactory(new SMTPAuthenticator("test", "test12!")));
try {
wiser.start();
new MailMessageImpl(mailConfig).from(fromAddress).to(person.getEmail()).subject(subject).put("person", person).put("version", "Seam 3").bodyHtmlTextAlt(
new FreeMarkerTemplate(Resources.newInputStreamSupplier(Resources.getResource("template.html.freemarker")).getInput()),
new FreeMarkerTemplate(Resources.newInputStreamSupplier(Resources.getResource("template.text.freemarker")).getInput())).importance(MessagePriority.LOW)
.deliveryReceipt(fromAddress).readReceipt("seam.test").addAttachment("template.html.freemarker", "text/html", ContentDisposition.ATTACHMENT,
Resources.newInputStreamSupplier(Resources.getResource("template.html.freemarker")).getInput()).addAttachment(
new URLAttachment("http://design.jboss.org/seam/logo/final/seam_mail_85px.png", "seamLogo.png", ContentDisposition.INLINE)).send();
}
finally {
stop(wiser);
}
Assert.assertTrue("Didn't receive the expected amount of messages. Expected 1 got " + wiser.getMessages().size(), wiser.getMessages().size() == 1);
MimeMessage mess = wiser.getMessages().get(0).getMimeMessage();
Assert.assertEquals("Subject has been modified", subject, MimeUtility.unfold(mess.getHeader("Subject", null)));
EmailMessage convertedMessage = MessageConverter.convert(mess);
Assert.assertEquals(convertedMessage.getSubject(), subject);
}
开发者ID:codylerum,项目名称:simple-email,代码行数:34,代码来源:FreeMarkerMailMessageTest.java
注:本文中的org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论