We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
use Jasny\Auth\AuthMiddleware; use Jasny\Auth\AttributesHandler; $fn = static function (ServerRequestInterface $request) { return new ReflectionMethod($request->getAttribute('route.controller'), $request->getAttribute('route.action')); }; $middleware = new AuthMiddleware($auth, $fn, $responseFactory); $router->add($middleware);
If the callback for AuthMiddleware returns a reflection object, the attributes will be obtained and verified.
AuthMiddleware
use Jasny\Auth\Attributes\Roles; #[Roles('admin')] class AdminController { }
use Jasny\Auth\Attributes\Roles; use Jasny\Auth\Attributes\Context; #[Controller('clients')] class ClientController { #[Post('/:id')] #[Roles('manager')] public edit( #[Context] string $clientId, ) { // ... } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If the callback for
AuthMiddleware
returns a reflection object, the attributes will be obtained and verified.The text was updated successfully, but these errors were encountered: