For me worked only using

if (!in_array($userObject->getState(), $this->getOptions()->getAllowedLoginStates(), true)) {