Class EMailConfiguration
java.lang.Object
de.gustavblass.fsu.fmi.roombooking.configuration.EMailConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
@Configuration
public class EMailConfiguration
extends Object
implements org.springframework.context.ApplicationContextAware
Settings for the
EMailService.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.context.ApplicationContextThese domains are explicitly not permitted as part of the Actors' e-mail addresses.If this List is not empty, only these domains are permitted in the Actors' e-mail addresses.private @NonNull DurationThe timespan after which anEMailVerificationTokenshall expire. -
Constructor Summary
ConstructorsConstructorDescriptionEMailConfiguration(@Nullable Duration eMailVerificationTokenValidity, @Nullable String[] domainWhitelist, @Nullable String[] domainBlacklist) Constructs a newEMailConfiguration. -
Method Summary
Modifier and TypeMethodDescription@NonNull org.thymeleaf.TemplateEngineeMailTemplateEngine(@NonNull org.springframework.context.MessageSource messageSource) Creates a newTemplateEnginefor theEMailService.@NonNull Durationprivate @NonNull org.thymeleaf.templateresolver.ITemplateResolvervoidsetApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) private @NonNull org.thymeleaf.templateresolver.ITemplateResolver
-
Field Details
-
applicationContext
private org.springframework.context.ApplicationContext applicationContext -
eMailVerificationTokenValidity
The timespan after which anEMailVerificationTokenshall expire. -
domainWhitelist
If this List is not empty, only these domains are permitted in the Actors' e-mail addresses. Overrides thedomainBlacklist. -
domainBlacklist
These domains are explicitly not permitted as part of the Actors' e-mail addresses. Less important than thedomainWhitelist.
-
-
Constructor Details
-
EMailConfiguration
public EMailConfiguration(@Nullable @Value("${application.verificationToken.email.validity:}") @Nullable Duration eMailVerificationTokenValidity, @Nullable @Value("${application.mail.domains.whitelist:}") @Nullable String[] domainWhitelist, @Nullable @Value("${application.mail.domains.blacklist:}") @Nullable String[] domainBlacklist) Constructs a newEMailConfiguration.- Parameters:
eMailVerificationTokenValidity- TheeMailVerificationTokenValidity.domainWhitelist- ThedomainWhitelist.domainBlacklist- ThedomainBlacklist.
-
-
Method Details
-
eMailVerificationTokenValidity
- Returns:
- The
eMailVerificationTokenValidity.
-
eMailDomainWhitelist
@Bean @Contract(pure=true) @NonNull public @NonNull @Unmodifiable List<String> eMailDomainWhitelist()- Returns:
- An unmodifiable copy of the
domainWhitelist.
-
eMailDomainBlacklist
@Bean @Contract(pure=true) @NonNull public @NonNull @Unmodifiable List<String> eMailDomainBlacklist()- Returns:
- An unmodifiable copy of the
domainBlacklist.
-
eMailTemplateEngine
@Bean("eMailTemplateEngine") @NonNull public @NonNull org.thymeleaf.TemplateEngine eMailTemplateEngine(@NonNull @NonNull org.springframework.context.MessageSource messageSource) Creates a newTemplateEnginefor theEMailService.- Parameters:
messageSource- Used for i18n (internationalisation) in e-mails.- Returns:
- The new TemplateEngine suitable for parsing e-mail templates.
-
textTemplateResolver
@NonNull private @NonNull org.thymeleaf.templateresolver.ITemplateResolver textTemplateResolver()- Returns:
- A new
SpringResourceTemplateResolverthat theeMailTemplateEngine(MessageSource)is provided with, in order to find plain-text e-mail templates.
-
htmlTemplateResolver
@NonNull private @NonNull org.thymeleaf.templateresolver.ITemplateResolver htmlTemplateResolver()- Returns:
- A new
SpringResourceTemplateResolverthat theeMailTemplateEngine(MessageSource)is provided with, in order to find rich HTML e-mail templates.
-
setApplicationContext
public void setApplicationContext(@NonNull @NonNull org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-