Package io.continual.iam.tags
Interface TagManager
-
- All Known Subinterfaces:
IamDb<I,G>
- All Known Implementing Classes:
CommonJsonDb,JsonDocDb
public interface TagManagerTags 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringcreateTag(String userId, String appTagType, long duration, TimeUnit durationTimeUnit, String nonce)Create a tag for a given user id with a particular type and duration.StringgetUserIdForTag(String tag)Retrieves the userId associated with a tag.voidremoveMatchingTag(String userId, String appTagType)Remove any matching tag for the given user and type.voidsweepExpiredTags()Sweep any expired tags.
-
-
-
Method Detail
-
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
String getUserIdForTag(String tag) throws IamSvcException
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
void removeMatchingTag(String userId, String appTagType) throws IamSvcException
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
void sweepExpiredTags() throws IamSvcExceptionSweep 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
-
-