Load a login driver to the array of loaded drivers

@param   Array  settings for the new driver
@throws  AuthException  on driver load failure
509097
public static function forge($custom = array())
	{
		// Driver is given as array key or just string in custom
		$custom = ! is_array($custom) ? array('driver' => $custom) : $custom;
		$config = \Config::get('auth.'.$custom['driver'].'_config', array());
		$config = array_merge($config, $custom);

		// Driver must be set
		if (empty($config['driver']) || ! is_string($config['driver']))
		{
			throw new \AuthException('No auth driver given.');
		}

		// determine the driver to load
		$driver = \Auth_Login_Driver::forge($config);

		// get the driver's cookie name
		$id = $driver->get_id();

		// do we already have a driver instance for this cookie?
		if (isset(static::$_instances[$id]))
		{
			// if so, they must be using the same driver class!
			$class = get_class($driver);
			if ( ! static::$_instances[$id] instanceof $class)
			{
				throw new \AuthException('You can not instantiate two different login drivers using the same id "'.$id.'"');
			}
		}
		else
		{
			// store this instance
			static::$_instances[$id] = $driver;
		}

		// If we have more then one driver instance, check if we need concurrency
		if (count(static::$_instances) > 1)
		{
			// Whether to allow multiple drivers of any type, defaults to not allowed
			static::$_verify_multiple = \Config::get('auth.verify_multiple_logins', false);
		}

		return static::$_instances[$id];
	}
757959
public function setSettings($settings = [])
    {
        $original = $this->settings;
        $this->mergeSettings($settings, $this->settings);
        if ($this->settings != $original) {
            // @todo - Log Curl equivalent during test mode (adds overhead and risk so only do it during test)
            // if (!isset($this->settings['handler']) && class_exists(
            //         '\Namshi\Cuzzle\Middleware\CurlFormatterMiddleware'
            //     )) {
            //     $this->logger      = new Logger('guzzle.to.curl'); //initialize the logger
            //     $this->testHandler = new TestHandler(); //test logger handler
            //     $this->logger->pushHandler($this->testHandler);
            //
            //     $this->handler = HandlerStack::create();
            //     $this->handler->after('cookies', new \Namshi\Cuzzle\Middleware\CurlFormatterMiddleware($this->logger));
            //     $this->settings['handler'] = $this->handler;
            // }
            $this->client = new Client($this->settings);
        }
    }
490461
public function loadDrivers(): DriverCollection
    {
        $drivers = new DriverCollection($this);

        foreach ($this->drivers as $name => $driver) {
            $drivers->add($name, $driver);
        }

        return $drivers;
    }
1122833
public function initSettings(array $settings)
    {
        if (!isset($settings['tcp'])) {
            throw new \InvalidArgumentException('Tcp startup parameter is not configured，settings=' . \json_encode($settings));
        }

        if (!isset($settings['http'])) {
            throw new \InvalidArgumentException('HTTP startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['server'])) {
            throw new \InvalidArgumentException('server startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['setting'])) {
            throw new \InvalidArgumentException('"setting" parameters is not configured, settings=' . \json_encode($settings));
        }

        foreach ($settings['setting'] as $key => $value) {
            // path alias
            if ($value && \is_string($value) && $value[0] === '@') {
                $settings['setting'][$key] = App::getAlias($value);
            }
        }

        $this->setting = $settings['setting'];
        $this->tcpSetting = $settings['tcp'];
        $this->httpSetting = $settings['http'];
        $this->serverSetting = $settings['server'];

        // fix bug must to int
        if (isset($this->setting['task_ipc_mode'])) {
            $this->setting['task_ipc_mode'] = (int)$this->setting['task_ipc_mode'];
        }
        if (isset($this->setting['message_queue_key'])) {
            $this->setting['message_queue_key'] = (int)$this->setting['message_queue_key'];
        }
    }
71921
private function instantiateAuthentication()
    {
        foreach ((array) $this->getConfig('auth.bindings', []) as $binding) {
            $this->auths[] = $this->make($binding);
        }
    }
153365
function loadUserFields()
    {
        $user_fields = array();

        $this->container->get('event_dispatcher')->dispatch(SettingsEvents::BEFORE_LOAD_USERFIELDS, new FilterUserFieldsEvent($user_fields, $this->container));

        array_merge($user_fields, $user_fields = $this->container->getParameter("acs_settings.user_fields"));

        $user = $this->container->get('security.context')->getToken()->getUser();

        // If is admins we load the global system settings
        if (true === $this->container->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) {
            $user_fields = array_merge($user_fields, $system_fields = $this->container->getParameter("acs_settings.system_fields"));
        }

        $object_settings = $this->container->get('acs.setting_manager')->getObjectSettingsPrototype($user);

        $user_fields = array_merge($user_fields, $object_settings);

        $this->container->get('event_dispatcher')->dispatch(SettingsEvents::AFTER_LOAD_USERFIELDS, new FilterUserFieldsEvent($user_fields,$this->container));

        return $user_fields;
    }
241928
public function initialize()
    {
        if ($this->initialized === true) {
            return;
        }
        if ($this->canBeInitialized() === false) {
            throw new Exception('The security Context cannot be initialized yet. Please check if it can be initialized with $securityContext->canBeInitialized() before trying to do so.', 1358513802);
        }

        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $factoryTokens = $this->tokenAndProviderFactory->getTokens();
        $tokens = $this->mergeTokens($factoryTokens, $sessionDataContainer->getSecurityTokens());
        $this->separateActiveAndInactiveTokens($tokens);
        $this->updateTokens($this->activeTokens);

        $this->initialized = true;
    }
947619
public static function configureBasicAuth(array $settings)
    {
        if (!isset($settings['store_url'])) {
            throw new Exception("'store_url' must be provided");
        }

        if (!isset($settings['username'])) {
            throw new Exception("'username' must be provided");
        }

        if (!isset($settings['api_key'])) {
            throw new Exception("'api_key' must be provided");
        }

        self::$username = $settings['username'];
        self::$api_key = $settings['api_key'];
        self::$store_url = rtrim($settings['store_url'], '/');
        self::$api_path = self::$store_url . self::$path_prefix;
        self::$connection = false;
    }
1109892
public function injectSettings(array $settings)
    {
        $this->settings = $settings['persistence'];
        if (!is_array($this->settings['doctrine'])) {
            throw new InvalidConfigurationException(sprintf('The Neos.Flow.persistence.doctrine settings need to be an array, %s given.', gettype($this->settings['doctrine'])), 1392800005);
        }
    }
434950
public static void init(final AuthAPI authzAPI, AuthzFacade facade) throws Exception {
		/**
		 * Request User Role Access
		 */
		authzAPI.route(POST,"/authz/userRole",API.USER_ROLE_REQ,new Code(facade,"Request User Role Access", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.requestUserRole(trans, req, resp);
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.CREATED_201); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		
		
		/**
		 * Get UserRoles by Role
		 */
		authzAPI.route(GET,"/authz/userRoles/role/:role",API.USER_ROLES,new Code(facade,"Get UserRoles by Role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.getUserRolesByRole(trans, resp, pathParam(req,":role"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		
		/**
		 * Get UserRoles by User
		 */
		authzAPI.route(GET,"/authz/userRoles/user/:user",API.USER_ROLES,new Code(facade,"Get UserRoles by User", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.getUserRolesByUser(trans, resp, pathParam(req,":user"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});

		
		/**
		 * Update roles attached to user in path
		 */
		authzAPI.route(PUT,"/authz/userRole/user",API.USER_ROLE_REQ,new Code(facade,"Update Roles for a user", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.resetRolesForUser(trans, resp, req);
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		
		
		/**
		 * Update users attached to role in path
		 */
		authzAPI.route(PUT,"/authz/userRole/role",API.USER_ROLE_REQ,new Code(facade,"Update Users for a role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.resetUsersForRole(trans, resp, req);
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		
		/**
		 * Extend Expiration Date (according to Organizational rules)
		 */
		authzAPI.route(PUT, "/authz/userRole/extend/:user/:role", API.VOID, new Code(facade,"Extend Expiration", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.extendUserRoleExpiration(trans,resp,pathParam(req,":user"),pathParam(req,":role"));
				switch(r.status) {
				case OK:
					resp.setStatus(HttpStatus.OK_200); 
					break;
				default:
					context.error(trans,resp,r);
			}
	
			}
			
		});
		
		
		/**
		 * Create a new ID/Credential
		 */
		authzAPI.route(DELETE,"/authz/userRole/:user/:role",API.VOID,new Code(facade,"Delete User Role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.deleteUserRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});

	}
165936
public function loadSettingDefaults(array $fields, $user)
    {
        $user = $this->container->get('security.context')->getToken()->getUser();

        foreach($fields as $field){
            if (!$this->getSetting($field['setting_key'], $field['focus'], $user)) {
                if(!isset($field['default_value'])) {
                    $field['default_value'] = '';
                }
                $this->setSetting($field['setting_key'], $field['focus'], $field['default_value'], $field['context'], $user);
            }
        }

        //TODO: Increment schema_version setting
    }
1093146
protected function _load()
    {
        if (empty($this->_plugins)) {
            $this->_plugins = AnService::get('repos:settings.plugin')
                              ->getQuery()
                              ->where('enabled', '=', 1)
                              ->toEntityset();
        }

        return $this->_plugins;
    }
1128599
protected final void load()throws Exception
	{
		synchronized (this) {
			Set<Class<?>> classes=classProvider.getLoadedClasses();
			initScriptClasses(classes);
			onScriptLoaded(classes);
		}
	}
721382
public function loadSettings(array $settings)
    {
        $relationalManagerKey = $this->getOption(static::RELATIONAL_MANAGER_KEY);
        if (array_key_exists($relationalManagerKey, $settings)) {
            $this->registerEntityManagers((array) $settings[$relationalManagerKey]);
        }

        $mongoDBManagerKey = $this->getOption(static::MONGODB_MANAGER_KEY);
        if (array_key_exists($mongoDBManagerKey, $settings)) {
            $this->registerMongoDBDocumentManagers((array) $settings[$mongoDBManagerKey]);
        }

        $couchDBManagerKey = $this->getOption(static::COUCHDB_MANAGER_KEY);
        if (array_key_exists($couchDBManagerKey, $settings)) {
            $this->registerCouchDBDocumentManagers((array) $settings[$couchDBManagerKey]);
        }

        return $this;
    }
1370254
public function resolve(array $settings = [])
    {
        return (new Configuration())->newDefaultAnnotationDriver(
            Arr::get($settings, 'paths', []),
            Arr::get($settings, 'simple', false)
        );
    }
177203
public static function configureOAuth($settings)
    {
        if (!isset($settings['auth_token'])) {
            throw new Exception("'auth_token' must be provided");
        }

        if (!isset($settings['store_hash'])) {
            throw new Exception("'store_hash' must be provided");
        }

        self::$client_id = $settings['client_id'];
        self::$auth_token = $settings['auth_token'];
        self::$store_hash = $settings['store_hash'];

        self::$client_secret = isset($settings['client_secret']) ? $settings['client_secret'] : null;

        self::$api_path = self::$api_url . sprintf(self::$stores_prefix, self::$store_hash);
        self::$connection = false;
    }
603907
protected function setSettings(array $settings): void
    {
        $this->server->set(array_merge($this->defaultSettings, $this->settings, $settings));
    }