Authentication from within a plugin


#1

I have 3 different Dashboards in my website

Root
Admin
Manager

All the there have User authentication. But I want to have only one UsersController which may be placed under the main src/Controller folder.

Now my question is how may a config my auth component in Plugin’s BaseController.
I am trying like

$this->loadComponent('Auth', [
       'authenticate' => [
         'Form' => [
           'fields' => [
             'username' => 'username',
             'password' => 'password'
           ]
         ]
       ],
       'loginAction' => [
         'controller' => 'App\Users',
         'action' => 'login'
       ]
     ]);