-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom strategy for handling invalid cookies #2
base: main
Are you sure you want to change the base?
Allow custom strategy for handling invalid cookies #2
Conversation
c5e8562
to
83913ee
Compare
@@ -87,16 +97,14 @@ protected Object getFlashMapsMutex(HttpServletRequest request) { | |||
private List<FlashMap> decode(String value) { | |||
final String[] signatureAndPayload = reverse(value).split("--", 2); | |||
if (signatureAndPayload.length != 2) { | |||
// TODO logging | |||
return null; | |||
return verificationFailureHandler.onInvalidValue(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the semantics of this failure, i.e. what went wrong? And is is worth distinguishing between onInvalidValue()
and onInvalidSignature()
? In both cases, the content of the cookie was not as expected.
|
||
List<FlashMap> onInvalidValue(String value); | ||
|
||
List<FlashMap> onInvalidSignature(String payload, String signature); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be legal to throw e.g. an IllegalStateException
in case the signature is invalid? I assume that would lead to a 500 in Spring MVC, which would be good.
83913ee
to
f4923fc
Compare
This feature allows to customise the behaviour of what should be done in case the cookie can not be verified. By default the cookie is silently ignored, as before. Closes #1
f4923fc
to
6d9bd90
Compare
Adds
CookieVerificationFailureHandler
which can be used to customise the behaviour for handling invalid cookies.Closes #1