hanami / controller

Complete, fast and testable actions for Rack and Hanami
http://hanamirb.org
MIT License
246 stars 111 forks source link

feat: Support CSRF token retrieval from header "X-CSRF-Token" #422

Open masterT opened 1 year ago

masterT commented 1 year ago

Retrieve the request CSRF token from the HTTP header X-CSRF-Token in the case the params _csrf_token is not provided.

Reference:

timriley commented 1 year ago

Thanks for putting this together, @masterT! However, rather than leave this as a hook inside actions for users to override, I'd prefer we just fully build in support for checking the header for the CSRF token in addition to the request's params.

Would you like to have a go at doing that?

masterT commented 1 year ago

Sure, I will craft something.

masterT commented 1 year ago

I did implement your suggestion, this is ready for review. 🙂 @timriley