Class MongoUidVerificationTokenDao

java.lang.Object
dev.getelements.elements.dao.mongo.MongoUidVerificationTokenDao
All Implemented Interfaces:
UidVerificationTokenDao

public class MongoUidVerificationTokenDao extends Object implements UidVerificationTokenDao
  • Constructor Details

    • MongoUidVerificationTokenDao

      public MongoUidVerificationTokenDao()
  • Method Details

    • createToken

      public String createToken(User user, String scheme, String uidId, Timestamp expiry)
      Description copied from interface: UidVerificationTokenDao
      Creates and persists a new token for the given user and UID.
      Specified by:
      createToken in interface UidVerificationTokenDao
      Parameters:
      user - the user that owns the UID
      scheme - the scheme of the UID to verify
      uidId - the id value of the UID to verify
      expiry - the expiry timestamp after which the token is invalid
      Returns:
      the opaque token string (also the database primary key)
    • findToken

      public Optional<UidVerificationToken> findToken(String token)
      Description copied from interface: UidVerificationTokenDao
      Returns the token data if present and not expired.
      Specified by:
      findToken in interface UidVerificationTokenDao
      Parameters:
      token - the opaque token string
      Returns:
      an Optional containing the token, or empty if absent or expired
    • deleteToken

      public void deleteToken(String token)
      Description copied from interface: UidVerificationTokenDao
      Deletes a token. Call after successful verification to enforce single-use semantics.
      Specified by:
      deleteToken in interface UidVerificationTokenDao
      Parameters:
      token - the opaque token string to delete
    • deleteTokensByUser

      public void deleteTokensByUser(User user)
      Description copied from interface: UidVerificationTokenDao
      Deletes all tokens belonging to the given user. Call on user deletion.
      Specified by:
      deleteTokensByUser in interface UidVerificationTokenDao
      Parameters:
      user - the user whose tokens should be removed
    • getDatastore

      public dev.morphia.Datastore getDatastore()
    • setDatastore

      @Inject public void setDatastore(dev.morphia.Datastore datastore)
    • getMongoUserDao

      public MongoUserDao getMongoUserDao()
    • setMongoUserDao

      @Inject public void setMongoUserDao(MongoUserDao mongoUserDao)
    • getMapperRegistry

      public MapperRegistry getMapperRegistry()
    • setMapperRegistry

      @Inject public void setMapperRegistry(MapperRegistry mapperRegistry)
    • getEventPublisher

      public Consumer<Event> getEventPublisher()
    • setEventPublisher

      @Inject public void setEventPublisher(Consumer<Event> eventPublisher)