public class SpincastFormsDoubleSubmitProtectionFilterDefault extends Object implements SpincastFormsDoubleSubmitProtectionFilter
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastFormsDoubleSubmitProtectionFilterDefault(SpincastFormsProtectionConfig spincastFormsProtectionConfig,
FlashMessageFactory flashMessageFactory,
Dictionary dictionary,
SpincastCryptoUtils cryptoUtils,
SpincastFormsDoubleSubmitProtectionRepository spincastFormsDoubleSubmitProtectionRepository) |
| Modifier and Type | Method and Description |
|---|---|
String |
createNewFormDoubleSubmitProtectionId()
Creates an id to use in a form that needs to be
protected.
|
protected SpincastCryptoUtils |
getCryptoUtils() |
protected Dictionary |
getDictionary() |
protected FlashMessageFactory |
getFlashMessageFactory() |
protected String |
getFormDoubleSubmitPrivateKey() |
protected SpincastFormsDoubleSubmitProtectionRepository |
getSpincastFormsDoubleSubmitProtectionRepository() |
protected SpincastFormsProtectionConfig |
getSpincastFormsProtectionConfig() |
protected org.spincast.shaded.org.apache.commons.lang3.tuple.Pair<Instant,String> |
getSubmittedFormInfo(String payloadEncrypted)
Returns the Date/ProtectionId or
null
if invalid. |
void |
handle(RequestContext<?> context)
Filter's handle main method.
|
protected void |
invalidFormMatchAction(RequestContext<?> context,
String message)
What to do when the submitted form is not valid
(already submitted for example).
|
@Inject public SpincastFormsDoubleSubmitProtectionFilterDefault(SpincastFormsProtectionConfig spincastFormsProtectionConfig, FlashMessageFactory flashMessageFactory, Dictionary dictionary, SpincastCryptoUtils cryptoUtils, SpincastFormsDoubleSubmitProtectionRepository spincastFormsDoubleSubmitProtectionRepository)
protected SpincastFormsProtectionConfig getSpincastFormsProtectionConfig()
protected FlashMessageFactory getFlashMessageFactory()
protected Dictionary getDictionary()
protected SpincastCryptoUtils getCryptoUtils()
protected SpincastFormsDoubleSubmitProtectionRepository getSpincastFormsDoubleSubmitProtectionRepository()
public void handle(RequestContext<?> context) throws FormAlreadySubmittedException, FormTooOldException
SpincastFormsDoubleSubmitProtectionFilterhandle in interface SpincastFormsDoubleSubmitProtectionFilterFormAlreadySubmittedException - if the form was already submitted. This
exception, by default, implements PublicException and contains a
message from the Dictionary to be displayed to the user.FormTooOldException - if the submitted form is too old. This
exception, by default, implements PublicException and contains a
message from the Dictionary to be displayed to the user.public String createNewFormDoubleSubmitProtectionId()
SpincastFormsDoubleSubmitProtectionFiltercreateNewFormDoubleSubmitProtectionId in interface SpincastFormsDoubleSubmitProtectionFilterprotected org.spincast.shaded.org.apache.commons.lang3.tuple.Pair<Instant,String> getSubmittedFormInfo(String payloadEncrypted)
null
if invalid.protected void invalidFormMatchAction(RequestContext<?> context, String message) throws Exception
PublicException with
an HTTP status code of HttpStatus.SC_BAD_REQUEST and
a public message.Exceptionprotected String getFormDoubleSubmitPrivateKey()
Copyright © 2019. All rights reserved.