@Service(value="blStaleStateProtectionService") public class StaleStateProtectionServiceImpl extends Object implements StaleStateProtectionService
StaleStateProtectionService
Modifier and Type | Field and Description |
---|---|
protected boolean |
staleStateProtectionEnabled |
static String |
STATECHANGENOTIFICATIONTOKEN |
static String |
STATEVERSIONTOKEN |
static String |
STATEVERSIONTOKENPARAMETER |
Constructor and Description |
---|
StaleStateProtectionServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
compareToken(String passedToken)
Compare the state version token provided by the request to what is resident in the user session.
|
String |
getStateVersionToken()
Retrieve the state version token resident in the user's session, or create one if it doesn't exist.
|
String |
getStateVersionTokenParameter()
Retrieve the parameter key used to harvest the state version token value from the request
|
void |
invalidateState()
Remove the current state version token in the user's session, if exists.
|
void |
invalidateState(boolean notify)
Remove the current state version token in the user's session, if exists.
|
boolean |
isEnabled()
Whether or not the protection provided by this service is active.
|
boolean |
sendRedirectOnStateChange(javax.servlet.http.HttpServletResponse response,
String... stateChangeParams)
Utility method to send a redirect for the current url with state change params cleared.
|
public static final String STATEVERSIONTOKEN
public static final String STATECHANGENOTIFICATIONTOKEN
public static final String STATEVERSIONTOKENPARAMETER
@Value(value="${stale.state.protection.enabled:false}") protected boolean staleStateProtectionEnabled
public void compareToken(String passedToken)
StaleStateProtectionService
StaleStateServiceException
is emitted.compareToken
in interface StaleStateProtectionService
passedToken
- the state version token from the requestpublic String getStateVersionToken()
StaleStateProtectionService
getStateVersionToken
in interface StaleStateProtectionService
public void invalidateState()
StaleStateProtectionService
invalidateState
in interface StaleStateProtectionService
public void invalidateState(boolean notify)
StaleStateProtectionService
invalidateState
in interface StaleStateProtectionService
notify
- Whether or not the request should be notified that state was invalidated. See StaleStateProtectionService.sendRedirectOnStateChange(HttpServletResponse, String...)
.public boolean sendRedirectOnStateChange(javax.servlet.http.HttpServletResponse response, String... stateChangeParams) throws IOException
StaleStateProtectionService
sendRedirectOnStateChange
in interface StaleStateProtectionService
response
- the current http responsestateChangeParams
- any request parameter names being used by the system to drive state changeStaleStateProtectionService.invalidateState()
IOException
public boolean isEnabled()
StaleStateProtectionService
isEnabled
in interface StaleStateProtectionService
public String getStateVersionTokenParameter()
StaleStateProtectionService
getStateVersionTokenParameter
in interface StaleStateProtectionService
Copyright © 2022. All rights reserved.