Class SpincastFormsDoubleSubmitProtectionFilterDefault
java.lang.Object
org.spincast.plugins.formsprotection.doublesubmit.SpincastFormsDoubleSubmitProtectionFilterDefault
- All Implemented Interfaces:
SpincastFormsDoubleSubmitProtectionFilter
public class SpincastFormsDoubleSubmitProtectionFilterDefault
extends Object
implements SpincastFormsDoubleSubmitProtectionFilter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpincastFormsDoubleSubmitProtectionFilterDefault(SpincastFormsProtectionConfig spincastFormsProtectionConfig, FlashMessageFactory flashMessageFactory, Dictionary dictionary, SpincastCryptoUtils cryptoUtils, SpincastFormsDoubleSubmitProtectionRepository spincastFormsDoubleSubmitProtectionRepository) -
Method Summary
Modifier and TypeMethodDescriptionCreates an id to use in a form that needs to be protected.protected SpincastCryptoUtilsprotected Dictionaryprotected FlashMessageFactoryprotected Stringprotected SpincastFormsProtectionConfiggetSubmittedFormInfo(String payloadEncrypted) Returns the Date/ProtectionId ornullif invalid.voidhandle(RequestContext<?> context) Filter's handle main method.protected voidinvalidFormMatchAction(RequestContext<?> context, String message) What to do when the submitted form is not valid (already submitted for example).
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastFormsDoubleSubmitProtectionFilterDefault
@Inject public SpincastFormsDoubleSubmitProtectionFilterDefault(SpincastFormsProtectionConfig spincastFormsProtectionConfig, FlashMessageFactory flashMessageFactory, Dictionary dictionary, SpincastCryptoUtils cryptoUtils, SpincastFormsDoubleSubmitProtectionRepository spincastFormsDoubleSubmitProtectionRepository)
-
-
Method Details
-
getSpincastFormsProtectionConfig
-
getFlashMessageFactory
-
getDictionary
-
getCryptoUtils
-
getSpincastFormsDoubleSubmitProtectionRepository
protected SpincastFormsDoubleSubmitProtectionRepository getSpincastFormsDoubleSubmitProtectionRepository() -
handle
public void handle(RequestContext<?> context) throws FormAlreadySubmittedException, FormTooOldException Description copied from interface:SpincastFormsDoubleSubmitProtectionFilterFilter's handle main method.- Specified by:
handlein interfaceSpincastFormsDoubleSubmitProtectionFilter- Throws:
FormAlreadySubmittedException- if the form was already submitted. This exception, by default, implementsPublicExceptionand contains a message from theDictionaryto be displayed to the user.FormTooOldException- if the submitted form is too old. This exception, by default, implementsPublicExceptionand contains a message from theDictionaryto be displayed to the user.
-
createNewFormDoubleSubmitProtectionId
Description copied from interface:SpincastFormsDoubleSubmitProtectionFilterCreates an id to use in a form that needs to be protected.- Specified by:
createNewFormDoubleSubmitProtectionIdin interfaceSpincastFormsDoubleSubmitProtectionFilter
-
getSubmittedFormInfo
protected org.spincast.shaded.org.apache.commons.lang3.tuple.Pair<Instant,String> getSubmittedFormInfo(String payloadEncrypted) Returns the Date/ProtectionId ornullif invalid. -
invalidFormMatchAction
What to do when the submitted form is not valid (already submitted for example). By default, throw aPublicExceptionwith an HTTP status code ofHttpStatus.SC_BAD_REQUESTand a public message.- Throws:
Exception
-
getFormDoubleSubmitPrivateKey
-