Interface TokenInfo
-
public interface TokenInfoTheTokenInfoprovides data associated with a login token and basic methods to verify the validity of token credentials at given point in time.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull java.util.Map<java.lang.String,java.lang.String>getPrivateAttributes()Returns the private attributes stored with this info object.@NotNull java.util.Map<java.lang.String,java.lang.String>getPublicAttributes()Returns the public attributes stored with this info object.@NotNull java.lang.StringgetToken()Returns the login token.@NotNull java.lang.StringgetUserId()Returns the ID of the user associated with this token info object.booleanisExpired(long loginTime)Returnstrueif the token has already expired;falseotherwise.booleanmatches(@NotNull TokenCredentials tokenCredentials)Returnstrueif the specified credentials can be successfully validated against the information stored in this instance.booleanremove()Tries to remove the login token and all related information.booleanresetExpiration(long loginTime)Resets the expiration time of the login token associated with the givenTokenInfo.
-
-
-
Method Detail
-
getUserId
@NotNull @NotNull java.lang.String getUserId()
Returns the ID of the user associated with this token info object.- Returns:
- the ID of the user.
-
getToken
@NotNull @NotNull java.lang.String getToken()
Returns the login token.- Returns:
- the login token.
-
isExpired
boolean isExpired(long loginTime)
Returnstrueif the token has already expired;falseotherwise.- Parameters:
loginTime- The login time used to calculate the expiration status.- Returns:
trueif the token has already expired;falseotherwise.
-
resetExpiration
boolean resetExpiration(long loginTime)
Resets the expiration time of the login token associated with the givenTokenInfo. Whether and when the expiration time of a given login token is being reset is an implementation detail. Implementations that don't allow for resetting the token's expiration time at all will always returnfalse.- Parameters:
loginTime- The current login time.- Returns:
trueif the expiration time has been reset, false otherwise.
-
remove
boolean remove()
Tries to remove the login token and all related information. This method returnstrueif the removal was successful.- Returns:
trueif the removal was successful,falseotherwise.
-
matches
boolean matches(@NotNull @NotNull TokenCredentials tokenCredentials)Returnstrueif the specified credentials can be successfully validated against the information stored in this instance.- Parameters:
tokenCredentials- The credentials to validate.- Returns:
trueif the specified credentials can be successfully validated against the information stored in this instance;falseotherwise.
-
getPrivateAttributes
@NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> getPrivateAttributes()
Returns the private attributes stored with this info object.- Returns:
- the private attributes stored with this info object.
-
getPublicAttributes
@NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> getPublicAttributes()
Returns the public attributes stored with this info object.- Returns:
- the public attributes stored with this info object.
-
-