public function testSecurityShouldBeMergedCorrectly()
 {
     $originalConfig = [['access_decision_manager' => ['strategy' => 'unanimous'], 'firewalls' => ['dev' => ['pattern' => '^/(_(profiler|wdt)|css|images|js)/', 'security' => false], 'main' => ['pattern' => '^/', 'provider' => 'chain_provider', 'organization-form-login' => ['csrf_provider' => 'form.csrf_provider', 'check_path' => 'oro_user_security_check', 'login_path' => 'oro_user_security_login'], 'logout' => ['path' => 'oro_user_security_logout'], 'organization-remember-me' => ['key' => '%secret%', 'name' => 'CRMRM', 'lifetime' => 1209600, 'httponly' => true], 'anonymous' => false]]], ['firewalls' => ['main' => ['organization-http-basic' => ['realm' => 'Secured REST Area'], 'provider' => 'oro_user', 'http-basic' => false, 'organization-form-login' => false, 'logout' => false, 'organization-remember-me' => false, 'anonymous' => true]], 'acl' => ['connection' => 'default']]];
     $additionalConfig = ['firewalls' => ['oauth' => ['resource_owners' => ['google' => '/login/check-google']]]];
     $expectedConfig = $originalConfig;
     $expectedConfig[0]['firewalls']['oauth'] = $additionalConfig['firewalls']['oauth'];
     $containerBuilder = new OroContainerBuilder();
     $containerBuilder->setExtensionConfig('security', $originalConfig);
     $platformExtension = new OroPlatformExtension();
     $mergeConfigurationIntoOne = new \ReflectionMethod('Oro\\Bundle\\PlatformBundle\\DependencyInjection\\OroPlatformExtension', 'mergeConfigIntoOne');
     $mergeConfigurationIntoOne->setAccessible(true);
     $mergeConfigurationIntoOne->invoke($platformExtension, $containerBuilder, 'security', $additionalConfig);
     $this->assertEquals($expectedConfig, $containerBuilder->getExtensionConfig('security'));
 }
 /**
  * Sets default implementation of the cache for WSSE nonces if a custom implementation is not specified
  *
  * @param OroContainerBuilder $container
  */
 protected function setupWsseNonceCache(OroContainerBuilder $container)
 {
     $securityConfig = $container->getExtensionConfig('security');
     if (isset($securityConfig[0]['firewalls']['wsse_secured']) && !isset($securityConfig[0]['firewalls']['wsse_secured']['wsse']['nonce_cache_service_id'])) {
         $securityConfig[0]['firewalls']['wsse_secured']['wsse']['nonce_cache_service_id'] = self::DEFAULT_WSSE_NONCE_CACHE_SERVICE_ID;
         $container->setExtensionConfig('security', $securityConfig);
         if (!$container->hasDefinition(self::DEFAULT_WSSE_NONCE_CACHE_SERVICE_ID)) {
             $wsseLifetime = 0;
             if (isset($securityConfig[0]['firewalls']['wsse_secured']['wsse']['lifetime'])) {
                 $wsseLifetime = $securityConfig[0]['firewalls']['wsse_secured']['wsse']['lifetime'];
             }
             $cacheServiceDef = new Definition(self::DEFAULT_WSSE_NONCE_CACHE_CLASS, [self::DEFAULT_WSSE_NONCE_CACHE_PATH]);
             if ($wsseLifetime) {
                 $cacheServiceDef->addMethodCall('setNonceLifeTime', [$wsseLifetime]);
             }
             $container->setDefinition(self::DEFAULT_WSSE_NONCE_CACHE_SERVICE_ID, $cacheServiceDef);
         }
     }
 }