Create a M2 module that will authorize CloudFlare Access requests. The documentation for CloudFlare Access request validation is linked further down below.
The module should:
- Intercept all HTTP requests to Magento frontend controllers.
- If the request doesn't have a
CF_Authorizationcookie, return a 403 response with a message readingmissing required cf authorization token. - If the cookie is present, then allow the request to pass through.
- A store configuration setting should determine if the module is Enabled / Disabled. The default value should be
false.
- Place all your code inside the
srcdirectory. - You can install Magento inside the
magentofolder.composer install- Then run
bin/magento install ... - You can symlink your module into a folder inside
app/codein order to test it. - Don't forget to add it to the modules list in
app/etc/config.phpand runbin/magento setup:upgrade.
- If you already know how to, you can use unit tests to check and iterate over your work more quickly without the need of testing manually inside Magento. Place the tests inside the
testsfolder. WRITING UNIT TESTS IS NOT A REQUIREMENT unless explicitly mentioned in the assignment.