Create authentication service

@param   ServiceLocatorInterface $services
@return  AuthenticationService
323038
public function createService( ServiceLocatorInterface $services )
    {
        $manager = $services->get( 'Zend\Session\ManagerInterface' );
        $storage = new Session( null, null, $manager );
        return new AuthenticationService( $services, $storage );
    }
148016
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Config');

        $service = new ModuleOptions($config['e4wzfcuserredirecturl']);
        return $service;
    }
1032908
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);

        return new Bcrypt(['cost' => $moduleOptions->getBcryptCost()]);
    }
110532
public function createService(ServiceLocatorInterface $sl)
    {
        $hydratingResultSet = new HydratingResultSet(new ObjectProperty(), new MelisCmsSiteRobot());
        $tableGateway       = new TableGateway('melis_cms_domain_robots', $sl->get('Zend\Db\Adapter\Adapter'), null, $hydratingResultSet);

        return new MelisCmsSiteRobotTable($tableGateway);
    }
1078924
public function createService( ServiceLocatorInterface $serviceLocator )
    {
        // Configure the definitions
        $config     = $serviceLocator->get( 'Configuration' );
        $srvConfig  = isset( $config['modules']['Grid\Core']['settings'] )
                    ? (array) $config['modules']['Grid\Core']['settings']
                    : array();
        return new Definitions( $srvConfig );
    }
612850
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $username = new Input();
        $username->setName('username');
        $username->setRequired(true);
        $username->setAllowEmpty(false);
        $username->getFilterChain()
                ->attach(new StringTrim())
                ->attach(new StripTags());

        $password = new Input();
        $password->setName('password');
        $password->setRequired(true);
        $password->setAllowEmpty(false);
        $password->getFilterChain()
                ->attach(new StringTrim())
                ->attach(new StripTags());
        $password->getValidatorChain()
                ->attach($serviceLocator->get('UghAuthentication\Authentication\Validator\Authentication'));

        $inputFilter = new InputFilter();
        $inputFilter->add($username);
        $inputFilter->add($password);

        return $inputFilter;
    }
466113
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

        if (!array_key_exists('third-party-connect', $config))
        {
            throw new \Exception('You must copy the third-party-connect.local.php.dist file to your config/autoload directory.');
        }

        return new TwitterService($config['third-party-connect']['twitter'], $serviceLocator->get('request'));
    }
743172
public function createService(ServiceLocatorInterface $validators)
    {
        /* @var $options InputFilterOptionsInterface */
        $options = $validators->getServiceLocator()->get(ModuleOptions::class);

        $chain = new ValidatorChain;

        $chain->attachByName('StringLength', [
            'min' => $options->getMinIdentityLength(),
            'max' => $options->getMaxIdentityLength(),
        ], true);

        if ($options->getIdentityRegexPattern()) {
            $chain->attachByName('Regex', [
                'messages' => [
                    Regex::NOT_MATCH => 'Incorrect identity. ' .
                        'Identity must contain alphanumeric characters without spaces',
                ],
                'pattern' => $options->getIdentityRegexPattern(),
            ], true);
        }

        return $chain;
    }
1257818
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

        $locations = isset($config['locations'])? $config['locations'] : [];

        return new LocationTranslator($locations);
    }
1022944
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $className = $this->getClassName();
        $keyName   = $this->getKeyName();
        $config    = $serviceLocator->get('config');
        $options   = isset($config[$keyName]) ? $config[$keyName] : [];
        return new $className($options);
    }
219538
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $options ModuleOptionsInterface */
        $options = $serviceLocator->get(ModuleOptions::class);

        $chain = new AdapterChain;
        $eventManager = $chain->getEventManager();

        // iterate and attach multiple adapters and events if offered
        foreach ($options->getAuthenticationAdapters() as $priority => $adapterName) {
            $adapter = $serviceLocator->get($adapterName);
            if (is_callable(array($adapter, 'authenticate'))) {
                $eventManager->attach('authenticate', [$adapter, 'authenticate'], $priority);
            }
            if (is_callable(array($adapter, 'logout'))) {
                $eventManager->attach('logout', [$adapter, 'logout'], $priority);
            }
        }

        return $chain;
    }
978858
public function getApplicableAuthenticators($service = Authenticator::LOGIN)
    {
        $authenticators = $this->getAuthenticators();

        /** @var Authenticator $authenticator */
        foreach ($authenticators as $name => $authenticator) {
            if (!($authenticator->supportedServices() & $service)) {
                unset($authenticators[$name]);
            }
        }

        if (empty($authenticators)) {
            throw new LogicException('No applicable authenticators found');
        }

        return $authenticators;
    }
390024
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');

        if (! array_key_exists('application_db', $config)) throw new \InvalidArgumentException('Missing config for application_db');

        $config = $config['application_db'];

        if (isset($config['use_event_store_adapter_connection']) && $config['use_event_store_adapter_connection']) {
            /** @var $es EventStore */
            $es = $serviceLocator->get('proophessor.event_store');

            return DoctrineEventStoreAdapterDecorator::getConnectionOfAdapter($es->getAdapter());
        } else {
            if (! array_key_exists('connection', $config)) throw new \InvalidArgumentException('Missing connection in application_db config');

            return DriverManager::getConnection($config['connection']);
        }
    }
1050766
function withServices(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type);
        }
        return $this;
    }
290075
protected function createService($service)
    {
        if (!isset($this->config[$service])) {
            throw new \InvalidArgumentException(sprintf('OAuth configuration not defined for the "%s" service.', $service));
        }

        $referenceType = true;
        $urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface';
        if (defined(sprintf('%s::ABSOLUTE_URL', $urlGeneratorInterface))) {
            $referenceType = $urlGeneratorInterface::ABSOLUTE_URL;
        }
        $credentials = new Credentials(
            $this->config[$service]['key'],
            $this->config[$service]['secret'],
            $this->urlGenerator->generate($this->options['callback_route'], array(
                'service' => strtolower($service)
            ), $referenceType)
        );

        $scope = isset($this->config[$service]['scope']) ? $this->config[$service]['scope'] : array();
        $uri = isset($this->config[$service]['uri']) ? new Uri($this->config[$service]['uri']) : null;

        if (isset($this->config[$service]['class'])) {
            $this->oauthServiceFactory->registerService($service, $this->config[$service]['class']);
            unset($this->config[$service]['class']);
        }

        return $this->oauthServiceFactory->createService(
            $service,
            $credentials,
            $this->oauthStorage,
            $scope,
            $uri
        );
    }
1228973
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var DataMapperManager $dataMapperManager */
        $dataMapperManager = $serviceLocator->get(DataMapperManager::class);

        $password = $serviceLocator->get('Thorr\OAuth2\DefaultPasswordInterface');

        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);

        $adapter = new DataMapperAdapter($dataMapperManager, $password);
        $adapter->setUserClass($moduleOptions->getUserEntityClassName());

        return $adapter;
    }
489712
public function createService(ServiceLocatorInterface $container)
    {
        $config = $container->get(DbOptions::class);
        return new Adapter($config->toArray());
    }