<commit_before><?php

namespace AerialShip\SamlSPBundle\DependencyInjection\Security\Factory;

use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Reference;


class SamlSpFactory extends AbstractFactory
{

    function __construct()
    {
        $this->defaultSuccessHandlerOptions['login_path'] = '/saml/sp/login';
        $this->defaultFailureHandlerOptions['login_path'] = '/saml/sp/login';
        $this->defaultFailureHandlerOptions['failure_path'] = '/saml/sp/failure';

        // these are available in listener->options[]
        $this->addOption('require_previous_session', false); // otherwise it will end up with throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.'); on each new session
        $this->addOption('login_path', '/saml/sp/login');
        $this->addOption('check_path', '/saml/sp/acs');
        $this->addOption('logout_path', '/saml/sp/logout');
        $this->addOption('failure_path', '/saml/sp/failure');
        $this->addOption('local_logout_path', '/logout');
        $this->addOption('target_path_parameter', $this->defaultSuccessHandlerOptions['target_path_parameter']);
    }

    public function addConfiguration(NodeDefinition $node)
    {
        parent::addConfiguration($node);
        $node->children()
            ->scalarNode('relying_party')->defaultValue(null)->end()
            ->scalarNode('login_path')->defaultValue('/saml/sp/login')->cannotBeEmpty()->end()
            ->scalarNode('check_path')->defaultValue('/saml/sp/acs')->cannotBeEmpty()->end()
            ->scalarNode('logout_path')->defaultValue('/saml/sp/logout')->cannotBeEmpty()->end()
            ->scalarNode('failure_path')->defaultValue('/saml/sp/failure')->cannotBeEmpty()->end()
            ->scalarNode('metadata_path')->defaultValue('/saml/sp/FederationMetadata.xml')->cannotBeEmpty()->end()
            ->scalarNode('discovery_path')->defaultValue('/saml/sp/discovery')->cannotBeEmpty()->end()
            ->scalarNode('local_logout_path')->defaultValue('/logout')->cannotBeEmpty()->end()
            ->booleanNode('create_user_if_not_exists')->defaultFalse()->end()
            ->arrayNode('services')
                ->isRequired()
                ->requiresAtLeastOneElement()
                ->prototype('array')
                    ->children()
                        ->arrayNode('idp')->isRequired()
                            ->children()
                                ->scalarNode('file')->end()
                                ->scalarNode('entity_id')->end()
                                ->scalarNode('id')->end()
                            ->end()
                        ->end()
                        ->arrayNode('sp')->addDefaultsIfNotSet()
                            ->children()
                                ->arrayNode('config')->addDefaultsIfNotSet()
                                    ->children()
                                        ->scalarNode('entity_id')->cannotBeEmpty()->isRequired()->end()<commit_msg>fix service configuration merge causing loss of service names<commit_after><?php

namespace AerialShip\SamlSPBundle\DependencyInjection\Security\Factory;

use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Reference;


class SamlSpFactory extends AbstractFactory
{

    function __construct()
    {
        $this->defaultSuccessHandlerOptions['login_path'] = '/saml/sp/login';
        $this->defaultFailureHandlerOptions['login_path'] = '/saml/sp/login';
        $this->defaultFailureHandlerOptions['failure_path'] = '/saml/sp/failure';

        // these are available in listener->options[]
        $this->addOption('require_previous_session', false); // otherwise it will end up with throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.'); on each new session
        $this->addOption('login_path', '/saml/sp/login');
        $this->addOption('check_path', '/saml/sp/acs');
        $this->addOption('logout_path', '/saml/sp/logout');
        $this->addOption('failure_path', '/saml/sp/failure');
        $this->addOption('local_logout_path', '/logout');
        $this->addOption('target_path_parameter', $this->defaultSuccessHandlerOptions['target_path_parameter']);
    }

    public function addConfiguration(NodeDefinition $node)
    {
        parent::addConfiguration($node);
        $node->children()
            ->scalarNode('relying_party')->defaultValue(null)->end()
            ->scalarNode('login_path')->defaultValue('/saml/sp/login')->cannotBeEmpty()->end()
            ->scalarNode('check_path')->defaultValue('/saml/sp/acs')->cannotBeEmpty()->end()
            ->scalarNode('logout_path')->defaultValue('/saml/sp/logout')->cannotBeEmpty()->end()
            ->scalarNode('failure_path')->defaultValue('/saml/sp/failure')->cannotBeEmpty()->end()
            ->scalarNode('metadata_path')->defaultValue('/saml/sp/FederationMetadata.xml')->cannotBeEmpty()->end()
            ->scalarNode('discovery_path')->defaultValue('/saml/sp/discovery')->cannotBeEmpty()->end()
            ->scalarNode('local_logout_path')->defaultValue('/logout')->cannotBeEmpty()->end()
            ->booleanNode('create_user_if_not_exists')->defaultFalse()->end()
            ->arrayNode('services')
                ->isRequired()
                ->requiresAtLeastOneElement()
                ->useAttributeAsKey('name')
                ->prototype('array')
                    ->children()
                        ->arrayNode('idp')->isRequired()
                            ->children()
                                ->scalarNode('file')->end()
                                ->scalarNode('entity_id')->end()
                                ->scalarNode('id')->end()
                            ->end()
                        ->end()
                        ->arrayNode('sp')->addDefaultsIfNotSet()
                            ->children()
                                ->arrayNode('config')->addDefaultsIfNotSet()
                                    ->children()
                                        ->scalarNode('entity_id')->cannotBeEmpty()->isRequired()->end()
{'fraction_non_alphanumeric': 0.15569582206191765, 'fraction_numerical': 0.0, 'mean_word_length': 2.5305039787798407, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 150, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2501118', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1634, 'n_words': 204}