Package com.atlassian.crowd.service
Interface CrowdRememberMeService
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.voidClears all expired remember me tokensvoidClears all remember me tokens for all the usersvoidclearAllTokensForDirectory(Long directoryId) Clears all remember me tokens for the users belonging to the given directoryIdvoidclearAllTokensForSeries(String series) Clears all remember me tokens for the user with given seriesvoidclearAllTokensForUserInDirectory(String username, Long directoryId) Clears all remember me tokens for the user with given username, and directory idvoidcreateCookie(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 configurationvoidremoveCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Clears the remember-me cookie and removes all remember-me tokens for the corresponding seriesvoidsaveConfiguration(CrowdSpecificRememberMeSettings configuration) Validates and stores passed configuration, ifCrowdSpecificRememberMeSettings.isEnabled()happens to befalseall 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 befalseall existing tokens will be expired immediately- Parameters:
configuration- new configuration
-
getConfiguration
CrowdSpecificRememberMeSettings getConfiguration()Retrieves current configuration- Returns:
- configuration
-