Package io.continual.iam.tags
Interface TagManager
- All Known Subinterfaces:
IamDb<I,G>
- All Known Implementing Classes:
CommonJsonDb,JsonDocDb,MultiSourceDb
public interface TagManager
Tags are randomized strings that are used to generate text that would be improbable
for attackers to guess. They're used for activities like user confirmation via email
or password reset request handling.
-
Method Summary
Modifier and TypeMethodDescriptionCreate a tag for a given user id with a particular type and duration.getUserIdForTag(String tag) Retrieves the userId associated with a tag.voidremoveMatchingTag(String userId, String appTagType) Remove any matching tag for the given user and type.voidSweep any expired tags.
-
Method Details
-
createTag
String createTag(String userId, String appTagType, long duration, TimeUnit durationTimeUnit, String nonce) throws IamSvcException Create a tag for a given user id with a particular type and duration. If a tag for the same user with the same type exists, it's replaced with the new tag.- Parameters:
userId- a user IDappTagType- a tag typeduration- the length of time the tag should existdurationTimeUnit- the time unit for the durationnonce- used to seed random number generator- Returns:
- a tag
- Throws:
IamSvcException- if there's a problem in the IAM service
-
getUserIdForTag
Retrieves the userId associated with a tag. If the tag has expired, null is returned.- Parameters:
tag- a tag generated by createTag- Returns:
- a user ID or null if no entry exists (or an entry existed but expired)
- Throws:
IamSvcException- if there's a problem in the IAM service
-
removeMatchingTag
Remove any matching tag for the given user and type.- Parameters:
userId- a user IDappTagType- a tag type- Throws:
IamSvcException- if there's a problem in the IAM service
-
sweepExpiredTags
Sweep any expired tags. The tag manager implementation may not actually require this operation. In that case, make it a no-op.- Throws:
IamSvcException- if there's a problem in the IAM service
-