• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EasyAuthenticationHandlerFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntervalList类代码示例发布时间:2022-05-23
下一篇:
Java UDPAddressingMode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap