emailTokenProvider

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.

Can be used in:

login and bean

Sample

<login location="../examples/login/dialog/" path="/login/">
  <staticUserDataProvider>
    <user username="john" password="secret" email="john@example.com"/>
  </staticUserDataProvider>
  <emailTokenProvider
	smtpHost="smtp.example.com"
	smtpPort="465"
	smtpUser="tokensender"
	smtpPassword="somepassword"
	sender="tokens@example.com"
	recipient="${email}"
	subject="Login System Token"
	body="Some test text and the token: ${token}" />
</login>