Skip to content
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

feature: Expect Protect endpoints to support configuration request methods (all / get / post / put / delete / ...) #129

Open
ZhongxuYang opened this issue Feb 17, 2025 · 5 comments
Labels
feature-request New feature or request

Comments

@ZhongxuYang
Copy link

ZhongxuYang commented Feb 17, 2025

This plugin is awesome! But I have a little suggestion:

Expect Protect endpoints to support configuration request methods (all / get / post / put / delete / ...), because some wordpress plugins use request methods to distinguish different services, not just paths. 😊


Usage Scenario:

  • The get method of /wp-json/forum does not validate the user, but needs to validate the user for put/post/delete.
@ZhongxuYang ZhongxuYang added the feature-request New feature or request label Feb 17, 2025
@nicumicle
Copy link
Owner

@ZhongxuYang this is a really cool feature. Thanks for suggesting it!

nicumicle added a commit that referenced this issue Feb 23, 2025
#135)

* #129: Add Request Method to Protect endpoints

* Regenerate i18n

* Refactor protect-endpoints-view

* Add unit tests for Protect endpoints
---------

Co-authored-by: nicumicle <[email protected]>
@ZhongxuYang
Copy link
Author

ZhongxuYang commented Mar 3, 2025

@nicumicle Hi there! I just uploaded the Zip file to test configuring request methods on Protect endpoints. Here are my test results:

  1. After configuring request methods, validation still occurs for all request methods
  2. Can"t disable validation by setting "Protect endpoints enabled: No"

I understand this feature is still under development - just wanted to make sure you"re aware of these issues. Thanks for your quick response on this! 😊

@nicumicle
Copy link
Owner

Hi @ZhongxuYang ,

I did some tests, and found a small bug.
Now, it should be fixed. I even added a couple of integration tests to ensure that most of the scenarios are covered.

Can you please give it another try?
Thank you.

@ZhongxuYang
Copy link
Author

ZhongxuYang commented Mar 6, 2025

I tried and it still didn't work. Still the above two questions:

  1. After configuring request methods, validation still occurs for all request methods
  2. Can"t disable validation by setting "Protect endpoints enabled: No"

Configure

Image

Browser

Image Image

I have doubts if the plugin old version data has an effect on this, so I tried to reinstall it after uninstalling the plugin, but it still didn't work.

@nicumicle
Copy link
Owner

nicumicle commented Mar 6, 2025

This error is generated by the "All WordPress endpoints checks for JWT Authentication" option from General settings.

Image

If this option is enabled, the plugins will search for a JWT in the query parameters/headers/Sesstion/Cookies.

You can read more here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants