java.lang.Object
com.irurueta.authserver.authorization.infrastructure.mail.MailConfiguration

@Configuration(proxyBeanMethods=false) @EnableConfigurationProperties(MailProperties.class) public class MailConfiguration extends Object
Wires the SMTP implementation of AccountMailer. The message source is private to the mailer, so it never competes with the application's own MessageSource bean.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final String
    Base name of the message bundles of this module.
    (package private) static final String
    Base name of the message bundle of the one-time token e-mails.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    accountMailer(org.springframework.mail.javamail.JavaMailSender mailSender, MailProperties properties)
    Creates the mailer.
    emailOttDelivery(org.springframework.mail.javamail.JavaMailSender mailSender, MailProperties properties)
    Creates the e-mail one-time token delivery.
    (package private) static org.springframework.context.MessageSource
    Builds the message source of the mailer.
    (package private) static org.springframework.context.MessageSource
    Builds the message source of the one-time token e-mails.
    (package private) static org.thymeleaf.TemplateEngine
    ottTemplateEngine(org.springframework.context.MessageSource messages)
    Builds the private Thymeleaf engine of the one-time token e-mails: HTML mode for mail/*.html, text mode for mail/*.txt, both from the classpath.
    private static org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
    resolver(String pattern, org.thymeleaf.templatemode.TemplateMode mode, int order)
    Builds a classpath resolver for the templates matching a pattern.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MailConfiguration

      public MailConfiguration()
  • Method Details

    • accountMailer

      @Bean public AccountMailer accountMailer(org.springframework.mail.javamail.JavaMailSender mailSender, MailProperties properties)
      Creates the mailer.
      Parameters:
      mailSender - Spring Mail sender configured by spring.mail.*.
      properties - sender, base URL and locale.
      Returns:
      the account mailer.
    • emailOttDelivery

      @Bean public OttDelivery emailOttDelivery(org.springframework.mail.javamail.JavaMailSender mailSender, MailProperties properties)
      Creates the e-mail one-time token delivery. Its Thymeleaf engine is built here and deliberately not exposed as a bean, because a TemplateEngine bean would replace the one of the web pages.
      Parameters:
      mailSender - Spring Mail sender configured by spring.mail.*.
      properties - sender, base URL and locale.
      Returns:
      the e-mail delivery of one-time tokens.
    • ottMessages

      static org.springframework.context.MessageSource ottMessages()
      Builds the message source of the one-time token e-mails.
      Returns:
      a source over mail/ott-mail that never falls back to the platform's locale.
    • ottTemplateEngine

      static org.thymeleaf.TemplateEngine ottTemplateEngine(org.springframework.context.MessageSource messages)
      Builds the private Thymeleaf engine of the one-time token e-mails: HTML mode for mail/*.html, text mode for mail/*.txt, both from the classpath.
      Parameters:
      messages - source of the texts referenced by the templates.
      Returns:
      the engine.
    • resolver

      private static org.thymeleaf.templateresolver.ClassLoaderTemplateResolver resolver(String pattern, org.thymeleaf.templatemode.TemplateMode mode, int order)
      Builds a classpath resolver for the templates matching a pattern.
      Parameters:
      pattern - resolvable template names.
      mode - template mode.
      order - position among the resolvers.
      Returns:
      the resolver.
    • mailMessages

      static org.springframework.context.MessageSource mailMessages()
      Builds the message source of the mailer.
      Returns:
      a source over the module's bundles that never falls back to the platform's locale.