/**
  * @DI\Observe("claroline_external_authentication_menu_configure")
  *
  * @param \Claroline\CoreBundle\Menu\ConfigureMenuEvent $event
  *
  * @return \Knp\Menu\ItemInterface $menu
  */
 public function onTopBarLeftMenuConfigure(ConfigureMenuEvent $event)
 {
     $menu = $event->getMenu();
     foreach (Configuration::resourceOwners() as $resourceOwner) {
         $menu->addChild($resourceOwner, array('route' => 'claro_admin_oauth_form', 'routeParameters' => array('service' => str_replace(' ', '_', strtolower($resourceOwner)))))->setExtra('name', $resourceOwner);
     }
     return $menu;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $configHandler = $this->container->get('claroline.config.platform_config_handler');
     foreach (Configuration::resourceOwners() as $resourceOwner) {
         $resourceOwnerStr = str_replace(' ', '_', strtolower($resourceOwner));
         $configHandler->setParameter($resourceOwnerStr . '_client_id', null);
         $configHandler->setParameter($resourceOwnerStr . '_client_secret', null);
         $configHandler->setParameter($resourceOwnerStr . '_client_active', null);
     }
 }
예제 #3
0
 /**
  * {@inheritdoc}
  *
  * Rewrites previous service definitions in order to force the dumped container to use
  * dynamic configuration parameters. Technique may vary depending on the target service
  * (see for example https://github.com/opensky/OpenSkyRuntimeConfigBundle).
  *
  * @param ContainerBuilder $container
  */
 public function process(ContainerBuilder $container)
 {
     $factory = new Reference('icap.oauth.hwi.resource_owner_factory');
     foreach (Configuration::resourceOwners() as $resourceOwner) {
         $resourceOwnerNoSpaces = str_replace(' ', '', $resourceOwner);
         $conf = new Definition();
         $conf->setClass($resourceOwnerNoSpaces . 'ResourceOwner');
         $conf->setFactory(array($factory, "get{$resourceOwnerNoSpaces}ResourceOwner"));
         $container->removeDefinition('hwi_oauth.resource_owner.' . str_replace(' ', '_', strtolower($resourceOwner)));
         $container->setDefinition('hwi_oauth.resource_owner.' . str_replace(' ', '_', strtolower($resourceOwner)), $conf);
     }
 }
예제 #4
0
 public function getActiveServices()
 {
     $services = array();
     foreach (Configuration::resourceOwners() as $resourceOwner) {
         $service = str_replace(' ', '_', strtolower($resourceOwner));
         if ($this->isActive($service)) {
             $services[] = $service;
         }
     }
     return $services;
 }