Class MongoUidVerificationTokenDao
java.lang.Object
dev.getelements.elements.dao.mongo.MongoUidVerificationTokenDao
- All Implemented Interfaces:
UidVerificationTokenDao
-
Field Summary
Fields inherited from interface dev.getelements.elements.sdk.dao.UidVerificationTokenDao
UID_VERIFICATION_TOKEN_CREATED, UID_VERIFICATION_TOKEN_DELETED, UID_VERIFICATION_TOKENS_TRUNCATED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateToken(User user, String scheme, String uidId, Timestamp expiry) Creates and persists a new token for the given user and UID.voiddeleteToken(String token) Deletes a token.voiddeleteTokensByUser(User user) Deletes all tokens belonging to the given user.Returns the token data if present and not expired.dev.morphia.DatastorevoidsetDatastore(dev.morphia.Datastore datastore) voidsetEventPublisher(Consumer<Event> eventPublisher) voidsetMapperRegistry(MapperRegistry mapperRegistry) voidsetMongoUserDao(MongoUserDao mongoUserDao)
-
Constructor Details
-
MongoUidVerificationTokenDao
public MongoUidVerificationTokenDao()
-
-
Method Details
-
createToken
Description copied from interface:UidVerificationTokenDaoCreates and persists a new token for the given user and UID.- Specified by:
createTokenin interfaceUidVerificationTokenDao- Parameters:
user- the user that owns the UIDscheme- the scheme of the UID to verifyuidId- the id value of the UID to verifyexpiry- the expiry timestamp after which the token is invalid- Returns:
- the opaque token string (also the database primary key)
-
findToken
Description copied from interface:UidVerificationTokenDaoReturns the token data if present and not expired.- Specified by:
findTokenin interfaceUidVerificationTokenDao- Parameters:
token- the opaque token string- Returns:
- an
Optionalcontaining the token, or empty if absent or expired
-
deleteToken
Description copied from interface:UidVerificationTokenDaoDeletes a token. Call after successful verification to enforce single-use semantics.- Specified by:
deleteTokenin interfaceUidVerificationTokenDao- Parameters:
token- the opaque token string to delete
-
deleteTokensByUser
Description copied from interface:UidVerificationTokenDaoDeletes all tokens belonging to the given user. Call on user deletion.- Specified by:
deleteTokensByUserin interfaceUidVerificationTokenDao- 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
-
setMongoUserDao
-
getMapperRegistry
-
setMapperRegistry
-
getEventPublisher
-
setEventPublisher
-