Package com.atlassian.jira.user
Interface SecureUserTokenManager
- All Known Implementing Classes:
DefaultSecureUserTokenManager
public interface SecureUserTokenManager
Provides the ability to generated and multiple secure tokens for a given user and type.
The token and type can then be resolved back to that user.
Tokens provided by these implementations should be generated securly (i.e. using DefaultSecureTokenGenerator
) expire after 30 minutes and only be available for use
once!
- Since:
- v4.4
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Token will be usable only for types of requests specified via this enum -
Method Summary
Modifier and TypeMethodDescriptiongenerateToken
(ApplicationUser user, SecureUserTokenManager.TokenType tokenType) Given a user and tokentype this method creates a new secure token and returns this token.useToken
(String token, SecureUserTokenManager.TokenType tokenType) Given a token and tokenType, this method returns the User that was mapped to this token and then revokes the token to ensure it can't be used again.
-
Method Details
-
generateToken
Given a user and tokentype this method creates a new secure token and returns this token. A particular user can have multiple tokens mapped at any given time.- Parameters:
user
- The user this token is fortokenType
- TheSecureUserTokenManager.TokenType
for this token- Returns:
- A new token or null if no user was provided
-
useToken
Given a token and tokenType, this method returns the User that was mapped to this token and then revokes the token to ensure it can't be used again.- Parameters:
token
- A secure tokentokenType
- TheSecureUserTokenManager.TokenType
for this token- Returns:
- The User mapped to this token, or null if no mapping can be found.
-