-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] #[IsSignatureValid]
attribute
#60395
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
base: 7.3
Are you sure you want to change the base?
[HttpFoundation] #[IsSignatureValid]
attribute
#60395
Conversation
4730169
to
c72ef83
Compare
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [KernelEvents::CONTROLLER_ARGUMENTS => ['onKernelControllerArguments', 30]]; |
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.
Can you explain this 30 why this 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.
Hi @94noni , thanks for your comment! ❤️
I set the priority to 30 because I want the IsSignatureValid
validation to be executed first, before IsCsrfTokenValidAttributeListener and IsGrantedAttributeListener.
But maybe I'm wrong, and one of those validations should actually run first, please let me know if the priority needs to be changed.
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.
i dont know on my side the proper priority but I wanted to know why you chose 30 that all
hope other review will confirm this choice :)
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.
IsCsrfTokenValidAttributeListener
: priority 25IsGrantedAttributeListener
: priority 20
30 makes sense to me if we want it run first, which I think we do.
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.
I too think it should run before any auth-related check that might open a session.
This is looking great @santysisi! I'll give it a more thorough review after 7.3 is released. |
c72ef83
to
85320cf
Compare
✨ New Feature:
#[IsSignatureValid]
AttributeThis attribute simplifies signature verification by applying it declaratively at the controller level.
✅ Usage Examples
🔥 Advanced Usage (with #60102)
When throw: true is passed, exceptions are thrown instead of returning responses directly: