Add Middleware feature, move validation to middleware
Closed this issue · 1 comments
Add a middleware feature. Validation.php would be removed, and a Middleware interface would be created. Validation would be moved to a custom implementation of this Middleware, and API Key validation would be moved to a separate Middleware implementation. The regular request validation Middleware will be enforced, but API Key validation will be optional.
Instead of using the $is_public
, $white_list_keys
, and $security_level
properties of the RequestHandler, this would be moved to custom Middleware implementations.
To add middleware to an Endpoint, you would override the $middleware
property and set it to an array of the Middleware classes that would be used.
You can create custom middleware by running ./synful -cmw MiddleWareName
from console. You would then override the action
function of the Middleware object. This will give you access to the Request object.
interface MiddleWare
{
public function performAction(Request $request);
}
Completed in PR #88