Package com.atlassian.crowd.service
Interface CrowdRememberMeService
- All Known Implementing Classes:
TransactionalRememberMeService
public interface CrowdRememberMeService
Service allowing storage, retrieval and manipulation of
CrowdRememberMeToken
- Since:
- v3.4
-
Method Summary
Modifier and TypeMethodDescriptionOptional<org.springframework.security.core.Authentication>
authenticate
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Attempts to authenticate a request using the remember-me cookie provided on the request.void
Clears all expired remember me tokensvoid
Clears all remember me tokens for all the usersvoid
clearAllTokensForDirectory
(Long directoryId) Clears all remember me tokens for the users belonging to the given directoryIdvoid
clearAllTokensForSeries
(String series) Clears all remember me tokens for the user with given seriesvoid
clearAllTokensForUserInDirectory
(String username, Long directoryId) Clears all remember me tokens for the user with given username, and directory idvoid
createCookie
(org.springframework.security.core.Authentication authentication, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Generates a new remember-me token for the user and sets the corresponding cookie on the response.Retrieves current configurationvoid
removeCookie
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Clears the remember-me cookie and removes all remember-me tokens for the corresponding seriesvoid
saveConfiguration
(CrowdSpecificRememberMeSettings configuration) Validates and stores passed configuration, ifCrowdSpecificRememberMeSettings.isEnabled()
happens to befalse
all existing tokens will be expired immediately
-
Method Details
-
authenticate
Optional<org.springframework.security.core.Authentication> authenticate(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) Attempts to authenticate a request using the remember-me cookie provided on the request. If authentication succeeds, a new remember-me token is created for the user and a new cookie is set on the response. If authentication fails for any reason, the cookie is cleared on the response.- Parameters:
request
- the requestresponse
- the response- Returns:
- the authenticated user, or
Optional.empty()
if authentication failed.
-
removeCookie
void removeCookie(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) Clears the remember-me cookie and removes all remember-me tokens for the corresponding series- Parameters:
request
- the requestresponse
- the response
-
createCookie
void createCookie(@Nonnull org.springframework.security.core.Authentication authentication, @Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response) Generates a new remember-me token for the user and sets the corresponding cookie on the response. This will cancel an existing remember me cookie if such was provided..- Parameters:
authentication
- valid authentication containing the user contextrequest
- the requestresponse
- the response
-
clearAllTokensForSeries
Clears all remember me tokens for the user with given series -
clearAllTokensForUserInDirectory
Clears all remember me tokens for the user with given username, and directory id -
clearAllTokens
void clearAllTokens()Clears all remember me tokens for all the users -
clearAllExpiredTokens
void clearAllExpiredTokens()Clears all expired remember me tokens -
clearAllTokensForDirectory
Clears all remember me tokens for the users belonging to the given directoryId -
saveConfiguration
Validates and stores passed configuration, ifCrowdSpecificRememberMeSettings.isEnabled()
happens to befalse
all existing tokens will be expired immediately- Parameters:
configuration
- new configuration
-
getConfiguration
CrowdSpecificRememberMeSettings getConfiguration()Retrieves current configuration- Returns:
- configuration
-