Interface InviteUserTokenService


public interface InviteUserTokenService
Service for handling invite user tokens
Since:
v2.8
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.atlassian.crowd.model.token.ExpirableUserToken
    createAndStoreToken(String email, long directoryId, int tokenExpirySeconds)
    Create a new token for the given email address and directory ID and store it
    Optional<com.atlassian.crowd.model.token.ExpirableUserToken>
    Find the token using the given random hash
    boolean
    Removes the token with the given random hash
  • Field Details

    • DEFAULT_TOKEN_EXPIRY_SECONDS

      static final int DEFAULT_TOKEN_EXPIRY_SECONDS
  • Method Details

    • createAndStoreToken

      com.atlassian.crowd.model.token.ExpirableUserToken createAndStoreToken(String email, long directoryId, int tokenExpirySeconds) throws com.atlassian.crowd.exception.ObjectAlreadyExistsException
      Create a new token for the given email address and directory ID and store it
      Parameters:
      email - the email address that the invitation was sent to
      directoryId - the directory ID that the user will be created to
      tokenExpirySeconds - number of seconds before generated token expires, or DEFAULT_TOKEN_EXPIRY_SECONDS
      Returns:
      the created token
      Throws:
      com.atlassian.crowd.exception.ObjectAlreadyExistsException - if a token already exists with the same random hash as the one that was generated.
      IllegalArgumentException - if tokenExpirySeconds is less than 0
    • findByToken

      Optional<com.atlassian.crowd.model.token.ExpirableUserToken> findByToken(String token)
      Find the token using the given random hash
      Parameters:
      token - random hash that was generated when the token was created
      Returns:
      the token if it was found, none otherwise
    • removeToken

      boolean removeToken(String token)
      Removes the token with the given random hash
      Parameters:
      token - random hash that was generated when the token was created
      Returns:
      true if a token was deleted, false otherwise