This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
PSR-7 Authorization Middleware
dev-master 2017-08-09 02:18 UTC
PSR-7 Authorization Middleware.
Install via composer:
$ composer require aist/authorization-middleware
Add pipe to protect whole app
// Add more middleware here that needs to introspect the routing results; this // might include: // // - route-based authentication // - route-based validation // - etc. // Authentication middleware $app->pipe(\Aist\AuthenticationMiddleware\Middleware\AuthenticationMiddleware::class); // Authorization middleware // At this point, if no identity is set by authorization middleware, the // UnauthorizedHandler kicks in; alternately, you can provide other fallback // middleware to execute. //$app->pipe(\Aist\AuthorizationMiddleware\Middleware\UnauthorizedHandler::class); // Authorization $app->pipe(\Aist\AuthorizationMiddleware\Middleware\AuthorizationMiddleware::class);
or use for specific route
$app->get( '/', [ \Aist\AuthenticationMiddleware\Middleware\AuthenticationMiddleware::class, \Aist\AuthorizationMiddleware\Middleware\AuthorizationMiddleware::class, App\Action\DashboardAction::class, ], 'dashboard' );