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(jakarta.servlet.http.HttpServletRequest request, jakarta.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(com.atlassian.crowd.embedded.api.User user, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Generates and saves a new remember-me token for the user.Retrieves current configurationvoidremoveCookie(jakarta.servlet.http.HttpServletRequest request, jakarta.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 jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.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 jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.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 com.atlassian.crowd.embedded.api.User user, @Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.servlet.http.HttpServletResponse response) Generates and saves a new remember-me token for the user. Sets the corresponding cookie on the response. If a remember-me cookie is already present in the response it will be overwritten.- Parameters:
user- the authenticating userrequest- the requestresponse- the response- Since:
- 6.2
-
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
-