Class SmtpAccountMailer
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.mail.SmtpAccountMailer
- All Implemented Interfaces:
AccountMailer
AccountMailer that sends plain-text messages through SMTP. Subject and body come from a
MessageSource resolved with the explicitly configured locale, never the platform's default. A delivery
failure is reported as an AccountMailException that carries neither the address nor the token, so the
calling use case rolls back whatever it stored for the message.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringMessage key prefix of the already-registered message.private final org.springframework.mail.javamail.JavaMailSenderSends the messages.private final org.springframework.context.MessageSourceSource of the subjects and bodies.private final MailPropertiesSender, base URL and locale.(package private) static final StringMessage key prefix of the reset message.(package private) static final StringPath of the page that lets the user choose a new secret.(package private) static final StringMessage key prefix of the e-mail verification message.(package private) static final StringPath of the verification endpoint. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringEncodes a value for a query parameter.private voidBuilds and sends one message.voidsendAlreadyRegistered(String email) Tells the owner of an address that someone tried to register it again.voidsendEmailVerification(String email, String token) Asks the owner of an address to confirm it.voidsendPasswordReset(String email, String token) Sends the link that allows choosing a new password.
-
Field Details
-
VERIFICATION
Message key prefix of the e-mail verification message.- See Also:
-
ALREADY_REGISTERED
Message key prefix of the already-registered message.- See Also:
-
RESET
Message key prefix of the reset message.- See Also:
-
VERIFY_PATH
Path of the verification endpoint.- See Also:
-
RESET_PATH
Path of the page that lets the user choose a new secret.- See Also:
-
mailSender
private final org.springframework.mail.javamail.JavaMailSender mailSenderSends the messages. -
messageSource
private final org.springframework.context.MessageSource messageSourceSource of the subjects and bodies. -
properties
Sender, base URL and locale.
-
-
Constructor Details
-
SmtpAccountMailer
public SmtpAccountMailer()
-
-
Method Details
-
sendEmailVerification
Description copied from interface:AccountMailerAsks the owner of an address to confirm it.- Specified by:
sendEmailVerificationin interfaceAccountMailer- Parameters:
email- address the message is sent to.token- signed verification token to include in the message.
-
sendAlreadyRegistered
Description copied from interface:AccountMailerTells the owner of an address that someone tried to register it again.- Specified by:
sendAlreadyRegisteredin interfaceAccountMailer- Parameters:
email- address the message is sent to.
-
sendPasswordReset
Description copied from interface:AccountMailerSends the link that allows choosing a new password.- Specified by:
sendPasswordResetin interfaceAccountMailer- Parameters:
email- address the message is sent to.token- single-use reset token to include in the message.
-
send
Builds and sends one message.- Parameters:
email- recipient address.prefix- message key prefix;.subjectand.bodyare appended.link- link inserted as the first argument of the body.- Throws:
AccountMailException- if the message cannot be delivered.
-
encode
Encodes a value for a query parameter.- Parameters:
value- value to encode.- Returns:
- the encoded value.
-