src/Auth/Auth.php
public function authenticate() {
        $userId = $this->session->get('userId');
        if ($userId !== null) {
            $user     = $this->authModel->getRoleAndUserFromIdUser($userId);
            if ($user) {
                $this->setUserId($userId);
                $this->setUsername($user['username']);
                $this->setRoleId($user['id_role']);
                $this->setRoleName($user['name']);
            } else {
                $this->logout();
            }
        } else {
            $this->logout();
        }
    }
public function authenticate() {
        $userId = $this->session->get('userId');
        if ($userId !== null) {
            $user     = $this->authModel->getRoleAndUserFromIdUser($userId);
            if ($user) {
                $this->setUserId($userId);
                $this->setUsername($user['username']);
                $this->setRoleId($user['id_role']);
                $this->setRoleName($user['name']);
            } else {
                $this->logout();
            }
        } else {
            $this->logout();
        }
    }
Logic of authentication.

@return void