Unable to resolve service error

Looks strange.
The normal usage in a controller is something like this: (pseudo code)

/** @var \Laminas\Authentication\AuthenticationService $authenticationService */
$authenticationService = $this->plugin('identity')->getAuthenticationService();

if ($this->getRequest()->isPost()) {
    $loginForm->setData((array)$this->getRequest()->getPost());

    if ($loginForm->isValid()) {
        $data = (array)$loginForm->getData();

        /** @var \Laminas\Authentication\Adapter\DbTable\AbstractAdapter $adapter */
        $adapter = $authenticationService->getAdapter();
        $adapter->setIdentity($data['username'])
            ->setCredential($data['password']);

        if ($authenticationService->authenticate()->isValid()) {
            // The default storage is session
            /** @var \Laminas\Authentication\Storage\Session $storage */
            $storage = $this->authenticationService->getStorage();
            $result  = $adapter->getResultRowObject(['role']);

            $storage->write(new UserEntity($result->role));

            return $this->redirect()->toRoute('…');
        }
    }
}