Class JdbcOneTimeTokenRepository
java.lang.Object
com.codename1.backend.security.mail.JdbcOneTimeTokenRepository
- All Implemented Interfaces:
OneTimeTokenRepository
Tokens kept in the server's database, in the
cn1_one_time_token table of
SecuritySchema. A token is used up by one DELETE that names it, and
counted as used only when that removed exactly one row, so two servers
handed the same link let one of them through.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUses a token up.voidDrops every tokenusernamehas forpurpose.voidKeeps a token forusername, in place of any that user had forpurpose: the newest link is the only one that works.
-
Constructor Details
-
JdbcOneTimeTokenRepository
-
-
Method Details
-
save
Description copied from interface:OneTimeTokenRepositoryKeeps a token for
username, in place of any that user had forpurpose: the newest link is the only one that works.Parameters
tokenHash: the token's hashpurpose: what the token may be used forusername: whose it isnow: the moment, epoch milliseconds; tokens that expired before it may be droppedexpiresAt: when the token stops working, epoch milliseconds
- Specified by:
savein interfaceOneTimeTokenRepository
-
consume
Description copied from interface:OneTimeTokenRepositoryUses a token up. Answers the user it was given to, or null when there is none forpurpose, it has expired, or another caller used it first: of two callers with one token, one is answered.- Specified by:
consumein interfaceOneTimeTokenRepository
-
removeAll
Description copied from interface:OneTimeTokenRepositoryDrops every tokenusernamehas forpurpose.- Specified by:
removeAllin interfaceOneTimeTokenRepository
-