File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -78,3 +78,29 @@ AuthorizationMiddleware::
7878 $middlewareQueue->add(new AuthorizationMiddleware($this));
7979 $middlewareQueue->add(new RequestAuthorizationMiddleware());
8080 }
81+
82+ Controller Usage
83+ ================
84+
85+ When having fallback routing activated, all asset based 404s as well as not existing controllers would also
86+ trigger the RequestAuthorizationMiddleware.
87+ In this case, it is possible to use this middleware only for your (App)controller::
88+
89+ // src/Controller/AppController.php
90+ public function initialize(): void
91+ {
92+ parent::initialize();
93+
94+ $this->middleware(function ($request, $handler): ResponseInterface {
95+ $config = [
96+ 'unauthorizedHandler' => [
97+ ...
98+ ],
99+ ];
100+ $middleware = new RequestAuthorizationMiddleware($config);
101+
102+ return $middleware->process($request, $handler);
103+ });
104+ }
105+
106+ Also note, that in this case you will e.g. need ``'DebugKit.ignoreAuthorization' `` set to ``true ``.
You can’t perform that action at this time.
0 commit comments