You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It must be added **after**`AuthenticationMiddleware` to ensure that it can read
55
55
the identify info after authentication is done.
56
56
57
+
If you don't have direct access to the place where `AuthenticationMiddleware` is added then check [here](#adding-middleware-via-event).
58
+
57
59
### Behavior
58
60
59
61
To use the included behavior to automatically update the `created_by` and `modified_by`
@@ -85,6 +87,25 @@ fields when creating a record, on the `modified_by` field again when updating
85
87
the record and it will use the associated user record's company `id` in the
86
88
`company_id` field when creating a record.
87
89
90
+
### Adding middleware via event
91
+
92
+
In some cases you don't have direct access to the place where the `AuthenticationMiddleware` is added. Then you will have to add this to your `src/Application.php`
93
+
94
+
```php
95
+
use Authentication\Middleware\AuthenticationMiddleware;
96
+
use Cake\Event\EventInterface;
97
+
use Cake\Http\MiddlewareQueue;
98
+
use Muffin\Footprint\Middleware\FootprintMiddleware;
99
+
100
+
// inside the bootstrap() method
101
+
$this->getEventManager()->on(
102
+
'Server.buildMiddleware',
103
+
function (EventInterface $event, MiddlewareQueue $middleware) {
0 commit comments