I'm struggling with the auth component. My authentication is managed inside a plugin. In the plugin's AppController.php I have set up this :
$this->loadComponent('Auth', [
'authenticate' => [ 'Form' => [ 'userModel' => 'BasUsers' ] ],
'loginAction' => [ 'controller' => 'BasUsers', 'action' => 'login', 'plugin' => 'Basic' ],
'userModel' => 'BasUsers',
'loginRedirect' => '/pages/home',
'logoutRedirect' => [ 'controller' => 'BasUsers', 'action' => 'login', 'plugin' => 'Basic' ],
'unauthorizedRedirect' => [ 'controller' => 'pages', 'action' => 'not-authorized' ],
'authError' => false,
'authorize' => ['Controller'],
]
);
I cannot manage to force a logout ( redirect to the login page ) when the session expires.
When the session ends, trying $this->request->session()->read( 'Auth.User.bas_users_role_id' ) returns null, but the controller / action is executed.
What am I missing ? Thanks.