Package com.codename1.backend.security.mail
package com.codename1.backend.security.mail
What a server does by mail on a user's behalf: resetting a forgotten password and proving that an address is theirs.
Both mail a link carrying a token from OneTimeTokenService: 256 random
bits that work once, for one purpose, until they expire. Only the token's
SHA-256 is kept, so a copy of the table opens nothing.
PasswordResetServicemails the link and sets the new password;http.passwordReset(...)adds the two pages in front of it.EmailVerificationServicemails the link and records the address as proved;http.emailVerification(...)adds the address the link opens.
A code mailed as a second factor at sign-in is
EmailCodeService.
Everything here sends through MailSender, so
it goes wherever cn1.mail.url says, and a test reads what was sent from
MailSender.sent().
-
ClassDescriptionSays where a user's mail goes.Proves that an address is a user's, by mailing it a link.Tokens kept in this process: gone when it stops, and unknown to any other server.Addresses kept in this process: gone when it stops.Tokens kept in the server's database, in the
cn1_one_time_tokentable ofSecuritySchema.Addresses kept in the server's database, in thecn1_verified_emailtable ofSecuritySchema.WhereOneTimeTokenServicekeeps the tokens it has given out: never a token, only its hash.Gives out tokens that work once: what a mailed link carries.Resets a forgotten password by mail.WhereEmailVerificationServicekeeps each user's address and whether it has been proved.