@param \SimpleSAML\Configuration $configuration
@param string                    $certificatePrefix

@return \SAML2\Configuration\ServiceProvider

@psalm-suppress UndefinedClass
420530
public static function convertToServiceProvider(
        Configuration $configuration,
        string $certificatePrefix = ''
    ) : ServiceProvider {
        $pluckedConfiguration = static::pluckConfiguration($configuration, $certificatePrefix);
        static::enrichForServiceProvider($configuration, $pluckedConfiguration);
        static::enrichForDecryptionProvider($configuration, $pluckedConfiguration);

        return new ServiceProvider($pluckedConfiguration);
    }
1153655
private function compile(Configuration $configuration)
    {
        $container = $this->loader->loadContainer($configuration);

        foreach ($configuration->getCompilerPasses() as $compilerPass) {
            $container->addCompilerPass($compilerPass);
        }

        $container->compile();

        return $container;
    }
1336956
public function createActionConfiguration(
        string $actionName,
        array $configuration,
        string $adminName,
        AdminConfiguration $adminConfiguration
    ): ActionConfiguration {
        $event = new ConfigurationEvent(
            $actionName,
            $adminConfiguration->getParameter('actions'),
            $adminName,
            $adminConfiguration->getParameter('entity')
        );
        $this->eventDispatcher->dispatch(Events::CONFIGURATION_ACTION, $event);

        $resolver = new OptionsResolver();
        $actionConfiguration = new ActionConfiguration($actionName, $adminName, $adminConfiguration);
        $actionConfiguration->configureOptions($resolver);
        $actionConfiguration->setParameters($resolver->resolve($configuration));

        return $actionConfiguration;
    }
31842
protected function getProviderDecorator(ContainerBuilder $container, array $config)
    {
        $type = $config['type'];
        $id   = 'doctrine_cache.abstract.' . $type;

        static $childDefinition;

        if (null === $childDefinition) {
            $childDefinition = class_exists('Symfony\Component\DependencyInjection\ChildDefinition') ? 'Symfony\Component\DependencyInjection\ChildDefinition' : 'Symfony\Component\DependencyInjection\DefinitionDecorator';
        }

        if ($type === 'custom_provider') {
            $type  = $config['custom_provider']['type'];
            $param = $this->getCustomProviderParameter($type);

            if ($container->hasParameter($param)) {
                return new $childDefinition($container->getParameter($param));
            }
        }

        if ($container->hasDefinition($id)) {
            return new $childDefinition($id);
        }

        throw new \InvalidArgumentException(sprintf('"%s" is an unrecognized Doctrine cache driver.', $type));
    }
1331461
public function hasValidSignature(
        SignedElement $signedElement,
        CertificateProvider $configuration
    ) : bool {
        foreach ($this->validators as $validator) {
            if ($validator->canValidate($signedElement, $configuration)) {
                $this->logger->debug(sprintf(
                    'Validating the signed element with validator of type "%s"',
                    get_class($validator)
                ));

                return $validator->hasValidSignature($signedElement, $configuration);
            }

            $this->logger->debug(sprintf(
                'Could not validate the signed element with validator of type "%s"',
                get_class($validator)
            ));
        }

        throw new MissingConfigurationException(sprintf(
            'No certificates have been configured%s',
            $configuration->has('entityid') ? ' for "'.$configuration->get('entityid').'"' : ''
        ));
    }
175978
private function getUsageParser(Configuration $configuration)
    {
        return new UsageParser(
            $this->getStaticAnalysisVisitors($configuration),
            $this->getViolationVisitors(),
            $this->getBaseTraverser(),
            new NodeTraverser(),
            new NodeTraverser()
        );
    }
576305
protected function startsWithPrefix($serviceId, $allowedPrefixes)
    {
        foreach ($allowedPrefixes as $prefix) {
            /* @var $prefix string */
            if (strpos($serviceId, $prefix) === 0) {
                return true;
            }
        }
        return false;
    }
955653
protected function initConfiguration($tags, $categories, $limit, $presentAs, $paginated, $sorting)
    {
        $configuration = new ProviderConfiguration();
        $configuration->setTags($tags);
        $configuration->setCategories($categories);
        $configuration->setLimit($limit);
        $configuration->setPresentAs($presentAs);
        $configuration->setPaginated($paginated);
        $configuration->setSorting($sorting);

        return $configuration;
    }
1195568
public function buildProvider($provider, $config)
    {
        return new $provider(
            $this->app['request'], $config['client_id'],
            $config['client_secret'], $this->formatRedirectUrl($config),
            Arr::get($config, 'guzzle', [])
        );
    }
903006
private function parseRemoteServiceProviderConfiguration(
        $serviceProvider
    ) {
        $configuration = $this->parseCertificateData('surfnet_saml.remote.service_provider[]', $serviceProvider);
        $configuration['entityId'] = $serviceProvider['entity_id'];
        $configuration['assertionConsumerUrl'] = $serviceProvider['assertion_consumer_service_url'];

        $definition = new Definition(ServiceProvider::class, [$configuration]);
        $definition->setPublic(false);

        return $definition;
    }
324305
public function createConfiguration($prefix, $resourceName, $resourceClass, array $templateList, $eventClass = null, $parentId = null)
    {
        return new Configuration(
            $prefix,
            $resourceName,
            $resourceClass,
            $templateList,
            $eventClass,
            $parentId
        );
    }
113528
protected function resolveTargetEntity(ParamConverter $configuration)
    {
        $class = $configuration->getClass();
        if (isset($this->mapping[$class])) {
            if ($this->mapping[$class] !== $class) {
                $configuration->setClass($this->mapping[$class]);
            }
        }

        return $configuration;
    }
322270
protected static function pluckConfiguration(Configuration $configuration, string $prefix = '') : array
    {
        $extracted = [];

        // ported from
        // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1092
        if ($configuration->hasValue($prefix.'keys')) {
            $extracted['keys'] = $configuration->getArray($prefix.'keys');
        }

        // ported from
        // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1108
        if ($configuration->hasValue($prefix.'certData')) {
            $extracted['certificateData'] = $configuration->getString($prefix.'certData');
        }

        // ported from
        // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1119
        if ($configuration->hasValue($prefix.'certificate')) {
            $extracted['certificateData'] = $configuration->getString($prefix.'certificate');
        }

        $extracted['assertionEncryptionEnabled'] = $configuration->getBoolean('assertion.encryption', false);

        if ($configuration->hasValue('sharedKey')) {
            $extracted['sharedKey'] = $configuration->getString('sharedKey');
        }

        return $extracted;
    }
1175421
public function setComposerConfiguration(array $configuration)
    {
        $this->composerJsonLoaded = true;
        $this->composerJson = null;
        $this->composerJson = $configuration;

        return $this->composerJson;
    }
1050799
public function load( Configurable $configuration ) {

		$rancherizePath = $this->getConfigPath();

		try {
			/**
			 * Only values under the `project` key should be written to the project config
			 */
			$prefixDecorator = new PrefixConfigurableDecorator( $configuration, 'project.' );

			$this->loader->load( $prefixDecorator, $rancherizePath );

			if ( $configuration instanceof HasSettableVersion )
				$configuration->setVersion( (int)$prefixDecorator->get('version', 1) );
		} catch ( FileNotFoundException $e ) {
			// No config yet, nothing to do
		}

		return $configuration;
	}
957343
public function configure(array $config, ConfigurationInterface $configuration, ContainerBuilder $container)
    {
        $processor = new Processor();
        $config    = $processor->processConfiguration($configuration, $config);

        $loader = new XmlFileLoader($container, new FileLocator($this->getConfigurationDirectory()));

		foreach(WallPosterBundle::getAvailableProviders() as $service)
		{
			if(isset($config[$service]))
			{
				$this->mapParameters($service, $config[$service], $container);
				$this->loadConfigurationFile($service,$loader);
			}
		}

        return array($config, $loader);
    }
461410
public function buildProvider($provider, $config)
    {
        $provider = new $provider(
            $this->app['request'], $config['client_id'],
            $config['client_secret'], $config['redirect_uri']
        );

        $provider->setBaseURL($config['tokenpass_url']);

        return $provider;
    }