Class DefaultInviteUserTokenService
java.lang.Object
com.atlassian.crowd.service.token.DefaultInviteUserTokenService
- All Implemented Interfaces:
InviteUserTokenService
@Transactional
public class DefaultInviteUserTokenService
extends Object
implements InviteUserTokenService
Default implementation of
InviteUserTokenService backed by a storage DAO.- Since:
- v2.8
-
Field Summary
Fields inherited from interface com.atlassian.crowd.service.token.InviteUserTokenService
DEFAULT_TOKEN_EXPIRY_SECONDS -
Constructor Summary
ConstructorsConstructorDescriptionDefaultInviteUserTokenService(ExpirableUserTokenDao expirableUserTokenDao, com.atlassian.security.random.SecureTokenGenerator tokenGenerator) -
Method Summary
Modifier and TypeMethodDescriptioncreateAndStoreToken(String email, long directoryId, int tokenExpirySeconds) Create a new token for the given email address and directory ID and store itprotected InstantfindByToken(String token) Find the token using the given random hashbooleanremoveToken(String token) Removes the token with the given random hash
-
Constructor Details
-
DefaultInviteUserTokenService
public DefaultInviteUserTokenService(ExpirableUserTokenDao expirableUserTokenDao, com.atlassian.security.random.SecureTokenGenerator tokenGenerator)
-
-
Method Details
-
createAndStoreToken
public ExpirableUserToken createAndStoreToken(String email, long directoryId, int tokenExpirySeconds) throws ObjectAlreadyExistsException Description copied from interface:InviteUserTokenServiceCreate a new token for the given email address and directory ID and store it- Specified by:
createAndStoreTokenin interfaceInviteUserTokenService- Parameters:
email- the email address that the invitation was sent todirectoryId- the directory ID that the user will be created totokenExpirySeconds- number of seconds before generated token expires, or DEFAULT_TOKEN_EXPIRY_SECONDS- Returns:
- the created token
- Throws:
ObjectAlreadyExistsException- if a token already exists with the same random hash as the one that was generated.
-
findByToken
Description copied from interface:InviteUserTokenServiceFind the token using the given random hash- Specified by:
findByTokenin interfaceInviteUserTokenService- Parameters:
token- random hash that was generated when the token was created- Returns:
- the token if it was found, none otherwise
-
removeToken
Description copied from interface:InviteUserTokenServiceRemoves the token with the given random hash- Specified by:
removeTokenin interfaceInviteUserTokenService- Parameters:
token- random hash that was generated when the token was created- Returns:
- true if a token was deleted, false otherwise
-
currentTime
-