Create an SSO server instance from the provider options

@return \Flowpack\SingleSignOn\Client\Domain\Model\SsoServer
356666
protected function createSsoServer() {
		if (!isset($this->options['server'])) {
			throw new Exception('Missing "server" option for SingleSignOnProvider authentication provider "' . $this->name . '". Please specifiy one using the providerOptions setting.', 1351690847);
		}
		$ssoServer = $this->ssoServerFactory->create($this->options['server']);
		return $ssoServer;
	}
521357
public function create()
    {
        $instance = self::createOptionSet($this);
        $this->setId($instance->getId());
        return $instance;
    }
534949
protected function createServer()
    {
        $config = $this->getServerInitConfig();
        $this->swooleServer = new \swoole_http_server($config['host'], $config['port'], $config['mode'], $config['sockType']);
    }
347264
public function create()
    {
        $instance = self::createAddress($this);
        $this->setId($instance->getId());
        return $instance;
    }
761889
public function makeAuthorizationServer()
    {
        return new AuthorizationServer(
            $this->app->make(Bridge\ClientRepository::class),
            $this->app->make(Bridge\AccessTokenRepository::class),
            $this->app->make(Bridge\ScopeRepository::class),
            $this->makeCryptKey('private'),
            app('encrypter')->getKey()
        );
    }
228765
public function createClient() {
        $this->client = $this->getKernel()->getContainer()->get('test.client');
        $client = $this->client;
        return $client;
    }
1276534
protected function createClient()
    {
        $options = CMap::mergeArray(
            array(
                'logger' => 'yii',
                'tags' => array(
                    'environment' => $this->environment,
                    'php_version' => phpversion(),
                ),
            ),
            $this->options
        );
        try {
            $this->checkTags($options['tags']);
            return new Raven_Client($this->dns, $options);
        } catch (Exception $e) {
            if (YII_DEBUG) {
                throw new CException('SentryClient failed to create client: ' . $e->getMessage(), (int)$e->getCode());
            } else {
                $this->log($e->getMessage(), CLogger::LEVEL_ERROR);
                throw new CException('SentryClient failed to create client.', (int)$e->getCode());
            }
        }
    }
851170
public static function createFromGlobal()
    {
        $instance = new self('');

        //~ Set scheme
        if (isset($_SERVER['HTTPS'])) {
            $instance->setScheme($_SERVER['HTTPS'] == 'on' ? 'https' : 'http');
        }

        //~ Set host
        if (isset($_SERVER['HTTP_HOST'])) {
            $instance->setHost($_SERVER['HTTP_HOST']);
        } elseif (isset($_SERVER['SERVER_NAME'])) {
            $instance->setHost($_SERVER['SERVER_NAME']);
        }

        //~ Set port
        if (isset($_SERVER['SERVER_PORT'])) {
            $instance->setPort($_SERVER['SERVER_PORT']);
        }

        //~ Set path
        if (isset($_SERVER['REQUEST_URI'])) {
            $instance->setPath(current(explode('?', $_SERVER['REQUEST_URI'])));
        }

        //~ Set query string
        if (isset($_SERVER['QUERY_STRING'])) {
            $instance->setQuery($_SERVER['QUERY_STRING']);
        }

        return $instance;
    }
854593
public function makeAuthorizationServer()
    {
        return new CustomAuthServer(
            $this->app->make(ClientRepository::class),
            $this->app->make(AccessTokenRepository::class),
            $this->app->make(ScopeRepository::class),
            'file://'.storage_path('oauth-private.key'),
            'file://'.storage_path('oauth-public.key')
        );
    }
158150
protected function createClient()
    {
        /** @var SSLCertificate $credentials */
        $credentials         = $this->getCredentials();
        $url                 = $this->getServiceURL();
        $transport           = !empty($url['transport']) ? $url['transport'] : self::SECURE_TRANSPORT_DEFAULT;

        $this->serviceClient = new SocketClient($url['host'], $url['port']);
        $this->serviceClient
            ->setTransport($transport)
            ->setContextOptions(array(
                'local_cert' => $credentials->getCertificate(),
                'passphrase' => $credentials->getCertificatePassPhrase(),
            ))
            ->addConnectionFlag(STREAM_CLIENT_PERSISTENT)
            ->setBlockingMode(false)
        ;

        return $this;
    }
712139
public function getServerInstance()
    {
        if (null === $this->serverUrl) {
            throw new \UnexpectedValueException('Server URL must be set');
        }

        $match = preg_match(
            '/https:\/\/(?<instance>.+)\.salesforce\.com/',
            $this->serverUrl,
            $matches
        );

        if (!$match || !isset($matches['instance'])) {
            throw new \RuntimeException('Server instance could not be determined');
        }

        return $matches['instance'];
    }
625074
private function createTokenServer()
    {
        // Catch errors for pdo object creation and creating the server
        try {
            // Create the server
            $storage = new \OAuth2\Storage\Pdo(
                [
                    'dsn' => $this->configuration->getDsn(),
                    'username' => $this->configuration->getUsername(),
                    'password' => $this->configuration->getPassword(),
                ]
            );
            $server = new \OAuth2\Server($storage);

            // Add grant types
            if ($this->configuration->getAuthorizationMode() === 1) {
                $server->addGrantType(new \OAuth2\GrantType\ClientCredentials($storage));
            } elseif ($this->configuration->getAuthorizationMode() === 2) {
                $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage));
            } elseif ($this->configuration->getAuthorizationMode() === 3) {
                $server->addGrantType(new \OAuth2\GrantType\ClientCredentials($storage));
                $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage));
            } else {
                throw new \Exception("Unknown authorization mode: \"{$this->configuration->getAuthorizationMode()}\".");
            }
        } catch (\Exception $ex) {
            throw $ex;
        }

        $this->tokenServer = $server;
        return $this;
    }
889913
public function create() {
        $data = Values::of(array());

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new ConfigurationInstance($this->version, $payload);
    }
761751
public function build()
    {
        $soapClientFactory = new SoapClientFactory();
        $soapClient = $soapClientFactory->factory($this->wsdl, $this->soapOptions);

        $client = new Client($soapClient, $this->username, $this->password, $this->token);

        if ($this->log) {
            $logPlugin = new LogPlugin($this->log);
            $client->getEventDispatcher()->addSubscriber($logPlugin);
        }

        return $client;
    }
1066247
public static function fromServer()
    {
        $config = new self();

        /*
         * Change configurations flags
         */
        if ($_SERVER['argc'] >= 2) {
            $argv = $_SERVER['argv'];

            for ($i = 1; $i < $_SERVER['argc']; ++$i) {
                $parameter = $argv[$i];

                if (preg_match('/^-fno-([a-z0-9\-]+)$/', $parameter, $matches)) {
                    $config->set($matches[1], false, 'optimizations');
                    unset($argv[$i]);
                    continue;
                }

                if (preg_match('/^-f([a-z0-9\-]+)$/', $parameter, $matches)) {
                    $config->set($matches[1], true, 'optimizations');
                    unset($argv[$i]);
                    continue;
                }

                if (preg_match('/^-W([a-z0-9\-]+)$/', $parameter, $matches)) {
                    $config->set($matches[1], false, 'warnings');
                    unset($argv[$i]);
                    continue;
                }

                if (preg_match('/^-w([a-z0-9\-]+)$/', $parameter, $matches)) {
                    $config->set($matches[1], true, 'warnings');
                    unset($argv[$i]);
                    continue;
                }

                if (preg_match('/^--([a-z0-9\-]+)$/', $parameter, $matches)) {
                    // Only known options
                    if (null !== $config->get($matches[1], 'extra')) {
                        $config->set($matches[1], true, 'extra');
                        unset($argv[$i]);
                    }

                    continue;
                }

                if (preg_match('/^--([a-z0-9\-]+)=(.*)$/', $parameter, $matches)) {
                    // Only known options
                    if (null !== $config->get($matches[1], 'extra')) {
                        $config->set($matches[1], $matches[2], 'extra');
                        unset($argv[$i]);
                    }

                    continue;
                }

                switch ($parameter) {
                    case '-q':
                    case '--quiet':
                        $config->set('silent', true);
                        break;
                    case '-v':
                        $config->set('verbose', true);
                        break;
                    default:
                        break;
                }
            }

            $_SERVER['argv'] = $argv = array_values($argv);
            $_SERVER['argc'] = $argc = \count($argv);
        }

        return $config;
    }
508707
protected function bootWsServer()
    {
        $this->ws = new ReactServer($this->loop);
        $this->ws->listen($this->option('port'), self::IP);
        
        return $this->ws;
    }
788226
protected function registerAuthorizationServer()
    {
        $this->app->singleton(AuthorizationServer::class, function () {
            return tap($this->makeAuthorizationServer(), function ($server) {
                $server->setDefaultScope(Passport::$defaultScope);

                $server->enableGrantType(
                    $this->makeAuthCodeGrant(), Passport::tokensExpireIn()
                );

                $server->enableGrantType(
                    $this->makeRefreshTokenGrant(), Passport::tokensExpireIn()
                );

                $server->enableGrantType(
                    $this->makePasswordGrant(), Passport::tokensExpireIn()
                );

                $server->enableGrantType(
                    new PersonalAccessGrant, Passport::personalAccessTokensExpireIn()
                );

                $server->enableGrantType(
                    new ClientCredentialsGrant, Passport::tokensExpireIn()
                );

                if (Passport::$implicitGrantEnabled) {
                    $server->enableGrantType(
                        $this->makeImplicitGrant(), Passport::tokensExpireIn()
                    );
                }
            });
        });
    }