Class EmailTokenProvider
- All Implemented Interfaces:
TokenProvider
- Description
The emailTokenProvider randomly generates a 6-digit token after the user entered her correct password.
The token is then sent to the user via email. The user's attribute email is used as the recipient email address. If this attribute has not been provided by the user data provider, the login attempt fails.
The email is sent using the SMTP protocol via the smtpHost. Optionally, ssl and smptPort can be set to configure the type of connection. Optionally, smtpUser and smtpPassword can be used to use sender authentification.
The email is assembled using sender, recipient, subject and body. All of these values may contain properties in the form of ${propertyname}.
The properties will be replaced by the corresponding user attributes set by the user data provider, or token will be replaced by the numeric token value.
- Explanation
- A token provider sending a randomly generated numeric token to the user via email.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBody()intvoidbooleanbooleanisSsl()voidrequestToken(Map<String, String> userAttributes) voidvoidsetRecipient(String recipient) voidvoidsetSimulate(boolean simulate) voidsetSmtpHost(String smtpHost) voidsetSmtpPassword(String smtpPassword) voidsetSmtpPort(int smtpPort) voidsetSmtpUser(String smtpUser) voidsetSsl(boolean ssl) voidsetSubject(String subject) Methods inherited from class com.predic8.membrane.core.interceptor.authentication.session.NumericTokenProvider
generateToken, verifyToken
-
Constructor Details
-
EmailTokenProvider
public EmailTokenProvider()
-
-
Method Details
-
init
-
requestToken
-
isSimulate
public boolean isSimulate() -
setSimulate
public void setSimulate(boolean simulate) - Description
- don't actually send emails, if set to true
-
getRecipient
-
setRecipient
- Description
- the recipient email address (templated)
-
getBody
-
setBody
- Description
- the email body (templated)
-
getSender
-
setSender
- Description
- the sender email address (templated)
-
getSubject
-
setSubject
- Description
- the email subject (templated)
-
getSmtpHost
-
setSmtpHost
- Description
- SMTP host
-
getSmtpUser
-
setSmtpUser
- Default
- don't authenticate
- Description
- SMTP user to use for sender authentication
-
getSmtpPort
public int getSmtpPort() -
setSmtpPort
public void setSmtpPort(int smtpPort) - Default
- 25
- Description
- the SMTP port to use
-
getSmtpPassword
-
setSmtpPassword
- Description
- the SMTP password to use for sender authentication
-
isSsl
public boolean isSsl() -
setSsl
public void setSsl(boolean ssl) - Default
- true
- Description
- whether to use SMTP over SSL
-