Interface VerifiedEmailRepository

All Known Implementing Classes:
InMemoryVerifiedEmailRepository, JdbcVerifiedEmailRepository

public interface VerifiedEmailRepository
Where EmailVerificationService keeps each user's address and whether it has been proved.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(String username)
    Forgets username's address.
    findEmail(String username)
    The address username claims, proved or not, or null.
    The address username has proved, or null when they claim none or have not proved the one they claim.
    boolean
    isVerified(String username)
    Whether the address username claims has been proved.
    boolean
    markVerified(String username, String proof, long now)
    Marks the address username claims as proved at now, when proof is the one it was recorded with.
    void
    savePending(String username, String email, String proof)
    Records email as the address username claims, not yet proved, in place of whatever was recorded -- a proved address included: a user has one address, and it is the one they gave last.
  • Method Details

    • savePending

      void savePending(String username, String email, String proof)
      Records email as the address username claims, not yet proved, in place of whatever was recorded -- a proved address included: a user has one address, and it is the one they gave last. An application that wants the old one to stand until the new one is proved keeps it in its own table and calls this when it lets go of it. proof is what markVerified(String, String, long) has to be given for this address: it stands for the one link that was mailed there, so a link mailed to an earlier address proves nothing about this one.
    • markVerified

      boolean markVerified(String username, String proof, long now)
      Marks the address username claims as proved at now, when proof is the one it was recorded with. False when the user claims none, or claims one recorded with another proof.
    • findEmail

      String findEmail(String username)
      The address username claims, proved or not, or null.
    • findVerifiedEmail

      String findVerifiedEmail(String username)
      The address username has proved, or null when they claim none or have not proved the one they claim. One read: an address replaced between two reads would be answered as proved when it is not.
    • isVerified

      boolean isVerified(String username)
      Whether the address username claims has been proved.
    • delete

      void delete(String username)
      Forgets username's address.