public class EmailTokenProvider extends NumericTokenProvider
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.
| Constructor and Description |
|---|
EmailTokenProvider() |
| Modifier and Type | Method and Description |
|---|---|
String |
getBody() |
String |
getRecipient() |
String |
getSender() |
String |
getSmtpHost() |
String |
getSmtpPassword() |
int |
getSmtpPort() |
String |
getSmtpUser() |
String |
getSubject() |
void |
init(Router router) |
boolean |
isSimulate() |
boolean |
isSsl() |
void |
requestToken(Map<String,String> userAttributes) |
void |
setBody(String body) |
void |
setRecipient(String recipient) |
void |
setSender(String sender) |
void |
setSimulate(boolean simulate) |
void |
setSmtpHost(String smtpHost) |
void |
setSmtpPassword(String smtpPassword) |
void |
setSmtpPort(int smtpPort) |
void |
setSmtpUser(String smtpUser) |
void |
setSsl(boolean ssl) |
void |
setSubject(String subject) |
generateToken, verifyTokenpublic void init(Router router)
public boolean isSimulate()
public void setSimulate(boolean simulate)
public String getRecipient()
public void setRecipient(String recipient)
public String getBody()
public void setBody(String body)
public String getSender()
public void setSender(String sender)
public String getSubject()
public void setSubject(String subject)
public String getSmtpHost()
public void setSmtpHost(String smtpHost)
public String getSmtpUser()
public void setSmtpUser(String smtpUser)
public int getSmtpPort()
public void setSmtpPort(int smtpPort)
public String getSmtpPassword()
public void setSmtpPassword(String smtpPassword)
public boolean isSsl()
public void setSsl(boolean ssl)
Copyright © 2022. All Rights Reserved.