@Transactional public class DefaultInviteUserTokenService extends Object implements InviteUserTokenService
InviteUserTokenService
backed by a storage DAO.DEFAULT_TOKEN_EXPIRY_SECONDS
Constructor and Description |
---|
DefaultInviteUserTokenService(ExpirableUserTokenDao expirableUserTokenDao,
com.atlassian.security.random.SecureTokenGenerator tokenGenerator) |
Modifier and Type | Method and Description |
---|---|
ExpirableUserToken |
createAndStoreToken(String email,
long directoryId,
int tokenExpirySeconds)
Create a new token for the given email address and directory ID and store it
|
protected org.joda.time.Instant |
currentTime() |
Optional<ExpirableUserToken> |
findByToken(String token)
Find the token using the given random hash
|
boolean |
removeToken(String token)
Removes the token with the given random hash
|
public DefaultInviteUserTokenService(ExpirableUserTokenDao expirableUserTokenDao, com.atlassian.security.random.SecureTokenGenerator tokenGenerator)
public ExpirableUserToken createAndStoreToken(String email, long directoryId, int tokenExpirySeconds) throws ObjectAlreadyExistsException
InviteUserTokenService
createAndStoreToken
in interface InviteUserTokenService
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_SECONDSObjectAlreadyExistsException
- if a token already exists with the same random hash as the one that was generated.public Optional<ExpirableUserToken> findByToken(String token)
InviteUserTokenService
findByToken
in interface InviteUserTokenService
token
- random hash that was generated when the token was createdpublic boolean removeToken(String token)
InviteUserTokenService
removeToken
in interface InviteUserTokenService
token
- random hash that was generated when the token was createdprotected org.joda.time.Instant currentTime()
Copyright © 2020 Atlassian. All rights reserved.