/** * @param IUser $user * @param FormFactory $formFactory */ public function __construct(IUser $user, FormFactory $formFactory, INamespaceDetector $namespaceDetector) { $this->user = $user; $this->formFactory = $formFactory; $this->namespace = $namespaceDetector->getNamespace(); InvalidSecurityNamespaceException::validate($this->namespace); $this->namespace->validateUser($user); }
public function authenticate(array $credentials) { /** @var SecurityNamespace $namespace */ $namespace = $this->namespaceDetector->getNamespace(); InvalidSecurityNamespaceException::validate($namespace); list($username, $password) = $credentials; $field = $namespace->isNamed() && strpos($username, '@') === FALSE ? 'username' : 'email'; $user = $namespace->getDao()->findOneBy([$field => $username]); $this->validateUser($user, $username); $this->validatePassword($user, $password); return new EntityIdentity($user); }
public function hasIdentityInitializer() { return $this->namespaceDetector->getNamespace()->hasIdentityInitializer(); }