@Transactional public class TransactionalRememberMeService extends Object implements CrowdRememberMeService
Constructor and Description |
---|
TransactionalRememberMeService(CrowdRememberMeTokenDAO tokenDAO,
CrowdRememberMeConfiguration rememberMeConfiguration,
com.atlassian.security.random.SecureTokenGenerator tokenGenerator,
Clock clock,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
Optional<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.
|
com.atlassian.fugue.Pair<InternalCrowdRememberMeToken,InternalCrowdRememberMeToken> |
claimSingleUseToken(InternalCrowdRememberMeToken token) |
void |
clearAllExpiredTokens()
Clears all expired remember me tokens
|
void |
clearAllTokens()
Clears all remember me tokens for all the users
|
void |
clearAllTokensForDirectory(Long directoryId)
Clears all remember me tokens for the users belonging to the given directoryId
|
void |
clearAllTokensForSeries(String series)
Clears all remember me tokens for the user with given series
|
void |
clearAllTokensForUserInDirectory(String username,
Long directoryId)
Clears all remember me tokens for the user with given username, and directory id
|
void |
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.
|
protected InternalCrowdRememberMeToken |
extractToken(javax.servlet.http.Cookie cookie) |
CrowdSpecificRememberMeSettings |
getConfiguration()
Retrieves current configuration
|
protected String |
getRemoteAddress(javax.servlet.http.HttpServletRequest request) |
LocalDateTime |
now() |
void |
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 series
|
void |
saveConfiguration(CrowdSpecificRememberMeSettings configuration)
Validates and stores passed configuration, if
CrowdSpecificRememberMeSettings.isEnabled() happens to be
false all existing tokens will be expired immediately |
public TransactionalRememberMeService(CrowdRememberMeTokenDAO tokenDAO, CrowdRememberMeConfiguration rememberMeConfiguration, com.atlassian.security.random.SecureTokenGenerator tokenGenerator, Clock clock, org.springframework.transaction.PlatformTransactionManager transactionManager)
@Nullable public Optional<org.springframework.security.core.Authentication> authenticate(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
CrowdRememberMeService
authenticate
in interface CrowdRememberMeService
request
- the requestresponse
- the responseOptional.empty()
if authentication failed.public void createCookie(@Nonnull org.springframework.security.core.Authentication authentication, @Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
CrowdRememberMeService
createCookie
in interface CrowdRememberMeService
authentication
- valid authentication containing the user contextrequest
- the requestresponse
- the responsepublic void removeCookie(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
CrowdRememberMeService
removeCookie
in interface CrowdRememberMeService
request
- the requestresponse
- the responsepublic void clearAllTokensForSeries(String series)
CrowdRememberMeService
clearAllTokensForSeries
in interface CrowdRememberMeService
public void clearAllTokensForUserInDirectory(String username, Long directoryId)
CrowdRememberMeService
clearAllTokensForUserInDirectory
in interface CrowdRememberMeService
public void clearAllTokens()
CrowdRememberMeService
clearAllTokens
in interface CrowdRememberMeService
public void clearAllExpiredTokens()
CrowdRememberMeService
clearAllExpiredTokens
in interface CrowdRememberMeService
public void clearAllTokensForDirectory(Long directoryId)
CrowdRememberMeService
clearAllTokensForDirectory
in interface CrowdRememberMeService
public void saveConfiguration(CrowdSpecificRememberMeSettings configuration)
CrowdRememberMeService
CrowdSpecificRememberMeSettings.isEnabled()
happens to be
false
all existing tokens will be expired immediatelysaveConfiguration
in interface CrowdRememberMeService
configuration
- new configurationpublic CrowdSpecificRememberMeSettings getConfiguration()
CrowdRememberMeService
getConfiguration
in interface CrowdRememberMeService
protected InternalCrowdRememberMeToken extractToken(javax.servlet.http.Cookie cookie)
public com.atlassian.fugue.Pair<InternalCrowdRememberMeToken,InternalCrowdRememberMeToken> claimSingleUseToken(InternalCrowdRememberMeToken token)
protected String getRemoteAddress(javax.servlet.http.HttpServletRequest request)
public LocalDateTime now()
Copyright © 2020 Atlassian. All rights reserved.