Init the Security Manager Engine and recover session variables.
195315
public function initSecurity()
    {
        $nb_engine = CNabuEngine::getEngine();
        $nb_session = $this->nb_application->getSession();

        $this->nb_role = $nb_session->getVariable(self::VAR_SESSION_ROLE, null);
        $this->nb_site_role = $nb_session->getVariable(self::VAR_SESSION_SITE_ROLE, null);
        $this->nb_user = $nb_session->getVariable(self::VAR_SESSION_USER, null);
        $this->nb_site_user = $nb_session->getVariable(self::VAR_SESSION_SITE_USER, null);
        $this->nb_work_customer = $nb_session->getVariable(self::VAR_SESSION_WORK_CUSTOMER, null);
    }
70308
private function init()
    {
        if ($this->init) {
            return;
        }
        $this->init = true;

        session_cache_limiter("");

        session_set_cookie_params($this->cookie->getLifetime(), $this->cookie->getPath(), $this->cookie->getDomain(), $this->cookie->isSecure(), $this->cookie->isHttpOnly());

        session_name($this->name);

        if ($this->id !== "") {
            session_id($this->id);
        }

        session_start([
            "read_and_close"    =>  true,
        ]);

        /**
         * If the cookie has a specific lifetime (not unlimited)
         * then ensure it is extended on each use of the session.
         */
        if ($this->cookie->getLifetime() > 0) {
            $expires = time() + $this->cookie->getLifetime();
            setcookie($this->name, session_id(), $expires, $this->cookie->getPath(), $this->cookie->getDomain(), $this->cookie->isSecure(), $this->cookie->isHttpOnly());
        }

        # Grab the sessions data to respond to get()
        $this->data = $_SESSION;

        # Grab session ID
        $this->id = session_id();
    }
1104815
def __init(self):
        

        params = {"f": "json"}
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_port=self._proxy_port,
                                 proxy_url=self._proxy_url)
        self._json = json.dumps(json_dict)
        self._json_dict = json_dict
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]
        for k,v in json_dict.items():
            if k == "tables":
                self._tables = []
                for tbl in v:
                    url = self._url + "/%s" % tbl['id']
                    self._tables.append(
                        TableLayer(url,
                                   securityHandler=self._securityHandler,
                                   proxy_port=self._proxy_port,
                                   proxy_url=self._proxy_url)
                    )
            elif k == "layers":
                self._layers = []
                for lyr in v:
                    url = self._url + "/%s" % lyr['id']
                    layer_type = self._getLayerType(url)
                    if layer_type == "Feature Layer":
                        self._layers.append(
                            FeatureLayer(url,
                                         securityHandler=self._securityHandler,
                                         proxy_port=self._proxy_port,
                                         proxy_url=self._proxy_url)
                        )
                    elif layer_type == "Raster Layer":
                        self._layers.append(
                            RasterLayer(url,
                                        securityHandler=self._securityHandler,
                                        proxy_port=self._proxy_port,
                                        proxy_url=self._proxy_url)
                        )
                    elif layer_type == "Group Layer":
                        self._layers.append(
                            GroupLayer(url,
                                       securityHandler=self._securityHandler,
                                       proxy_port=self._proxy_port,
                                       proxy_url=self._proxy_url)
                        )
                    elif layer_type == "Schematics Layer":
                        self._layers.append(
                            SchematicsLayer(url,
                                            securityHandler=self._securityHandler,
                                            proxy_port=self._proxy_port,
                                            proxy_url=self._proxy_url)
                        )    
                    else:
                        print ('Type %s is not implemented' % layer_type)
            elif k in attributes:
                setattr(self, "_"+ k, json_dict[k])

            else:
                print (k, " is not implemented for mapservice.")
1201764
def create_manager(self, yosai, settings, session_attributes):
        
        mgr_settings = SecurityManagerSettings(settings)
        attributes = mgr_settings.attributes

        realms = self._init_realms(settings, attributes['realms'])

        session_attributes = self._init_session_attributes(session_attributes, attributes)

        serialization_manager =\
            SerializationManager(session_attributes,
                                 serializer_scheme=attributes['serializer'])

        # the cache_handler doesn't initialize a cache_realm until it gets
        # a serialization manager, which is assigned within the SecurityManager
        cache_handler = self._init_cache_handler(settings,
                                                 attributes['cache_handler'],
                                                 serialization_manager)

        manager = mgr_settings.security_manager(yosai,
                                                settings,
                                                realms=realms,
                                                cache_handler=cache_handler,
                                                serialization_manager=serialization_manager)

        return manager
402161
def _init_session(self, session):
        # type: (requests.Session) -> None
        
        _patch_redirect(session)

        # Change max_retries in current all installed adapters
        max_retries = self.config.retry_policy()
        for protocol in self._protocols:
            session.adapters[protocol].max_retries = max_retries
512400
def init(opts=None):
    '''
    
    '''
    if opts is None:
        opts = __opts__
    try:
        DETAILS[_worker_name()] = SSHConnection(
            host=opts['proxy']['host'],
            username=opts['proxy']['username'],
            password=opts['proxy']['password'],
            key_accept=opts['proxy'].get('key_accept', False),
            ssh_args=opts['proxy'].get('ssh_args', ''),
            prompt='{0}.*(#|>) '.format(opts['proxy']['prompt_name']))
        DETAILS[_worker_name()].sendline('no cli session paging enable')

    except TerminalException as e:
        log.error(e)
        return False
    DETAILS['initialized'] = True
359688
def _instantiate_session(self, method_name, proxy=None, *args, **kwargs):
        """"""
        if 'manager' in kwargs:
            session_class = getattr(kwargs['manager'], method_name)
            del kwargs['manager']
        else:
            session_class = getattr(self._provider_manager, method_name)
        if proxy is None:
            try:
                return session_class(bank_id=self._catalog_id, *args, **kwargs)
            except AttributeError:
                return session_class(*args, **kwargs)
        else:
            try:
                return session_class(bank_id=self._catalog_id, proxy=proxy, *args, **kwargs)
            except AttributeError:
                return session_class(proxy=proxy, *args, **kwargs)
1245181
def load(self, session_id=None):
        

        if session_id is None:
            cookie_name = self._config.cookie_name
            self._data["session_id"] = web.cookies().get(cookie_name)
            self._data["cookieless"] = False
        else:
            if session_id == '':
                self._data["session_id"] = None  # will be created
            else:
                self._data["session_id"] = session_id
            self._data["cookieless"] = True

        # protection against session_id tampering
        if self._data["session_id"] and not self._valid_session_id(self._data["session_id"]):
            self._data["session_id"] = None

        self._check_expiry()
        if self._data["session_id"]:
            d = self.store[self._data["session_id"]]
            self.update(d)
            self._validate_ip()

        if not self._data["session_id"]:
            self._data["session_id"] = self._generate_session_id()

            if self._initializer:
                if isinstance(self._initializer, dict):
                    self.update(deepcopy(self._initializer))
                elif hasattr(self._initializer, '__call__'):
                    self._initializer()

        self._data["ip"] = web.ctx.ip
209805
public function initialize()
    {
        $this->hasOne('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'session']);
        $this->hasMany('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'sessions']);
        $this->hasMany('id', 'Baka\Auth\Models\SessionKeys', 'users_id', ['alias' => 'sessionKeys']);
        $this->hasMany('id', 'Baka\Auth\Models\Banlist', 'users_id', ['alias' => 'bans']);
        $this->hasMany('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'sessions']);
        $this->hasMany('id', 'Baka\Auth\Models\UserConfig', 'users_id', ['alias' => 'config']);
        $this->hasMany('id', 'Baka\Auth\Models\UserLinkedSources', 'users_id', ['alias' => 'sources']);
        $this->hasMany('id', 'Baka\Auth\Models\UsersAssociatedCompany', 'users_id', ['alias' => 'companies']);
        $this->hasOne('default_company', 'Baka\Auth\Models\Companies', 'id', ['alias' => 'defaultCompany']);
    }
633009
def init_session(db_url=None, echo=False, engine=None, settings=None):
    
    if engine is None:
        engine = init_engine(db_url=db_url, echo=echo, settings=settings)
    return sessionmaker(bind=engine)
760639
public void reset(SecurityRealm securityRealm) throws ServletException {
        if (securityRealm != null) {
            SecurityRealm.SecurityComponents sc = securityRealm.getSecurityComponents();
            AUTHENTICATION_MANAGER.setDelegate(sc.manager);
            USER_DETAILS_SERVICE_PROXY.setDelegate(sc.userDetails);
            REMEMBER_ME_SERVICES_PROXY.setDelegate(sc.rememberMe);
            // make sure this.filter is always a valid filter.
            Filter oldf = this.filter;
            Filter newf = securityRealm.createFilter(this.filterConfig);
            newf.init(this.filterConfig);
            this.filter = newf;
            if(oldf!=null)
                oldf.destroy();
        } else {
            // no security related filter needed.
            AUTHENTICATION_MANAGER.setDelegate(null);
            USER_DETAILS_SERVICE_PROXY.setDelegate(null);
            REMEMBER_ME_SERVICES_PROXY.setDelegate(null);
            filter = null;
        }
    }
1210384
public function initNewSession()
    {
        // starting session only if it was not started yet
        if (self::$_blIsNewSession) {
            $this->_sessionStart();
        }

        //saving persistent params if old session exists
        $aPersistent = [];
        foreach ($this->_aPersistentParams as $sParam) {
            if (($sValue = $this->getVariable($sParam))) {
                $aPersistent[$sParam] = $sValue;
            }
        }

        $this->_setSessionId($this->_getNewSessionId());

        //restoring persistent params to session
        foreach ($aPersistent as $sKey => $sParam) {
            $this->setVariable($sKey, $aPersistent[$sKey]);
        }

        $this->_initNewSessionChallenge();

        // (re)setting actual user agent when initiating new session
        $this->setVariable("sessionagent", \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getServerVar('HTTP_USER_AGENT'));
    }
31518
def restore(self):
        """"""
        if self.proxy_object is None:
            if self.getter:
                setattr(self.getter_class, self.attr_name, self.getter)
            elif self.is_local:
                setattr(self.orig_object, self.attr_name, self.orig_value)
            else:
                # Was not a local, safe to delete:
                delattr(self.orig_object, self.attr_name)
        else:
            setattr(sys.modules[self.orig_object.__module__],
                    self.orig_object.__name__,
                    self.orig_object)
983715
def Initialize(config=None,
               external_hostname = None,
               admin_password = None,
               redownload_templates = False,
               repack_templates = True,
               token = None):
  """"""

  print("Checking write access on config %s" % config["Config.writeback"])
  if not os.access(config.parser.filename, os.W_OK):
    raise IOError("Config not writeable (need sudo?)")

  print("\nStep 0: Importing Configuration from previous installation.")
  options_imported = 0
  prev_config_file = config.Get("ConfigUpdater.old_config", default=None)
  if prev_config_file and os.access(prev_config_file, os.R_OK):
    print("Found config file %s." % prev_config_file)
    # pytype: disable=wrong-arg-count
    if builtins.input("Do you want to import this configuration? "
                      "[yN]: ").upper() == "Y":
      options_imported = ImportConfig(prev_config_file, config)
    # pytype: enable=wrong-arg-count
  else:
    print("No old config file found.")

  print("\nStep 1: Setting Basic Configuration Parameters")
  print("We are now going to configure the server using a bunch of questions.")
  ConfigureDatastore(config)
  ConfigureUrls(config, external_hostname=external_hostname)
  ConfigureEmails(config)

  print("\nStep 2: Key Generation")
  if config.Get("PrivateKeys.server_key", default=None):
    if options_imported > 0:
      print("Since you have imported keys from another installation in the "
            "last step,\nyou probably do not want to generate new keys now.")
    # pytype: disable=wrong-arg-count
    if (builtins.input("You already have keys in your config, do you want to"
                       " overwrite them? [yN]: ").upper() or "N") == "Y":
      config_updater_keys_util.GenerateKeys(config, overwrite_keys=True)
    # pytype: enable=wrong-arg-count
  else:
    config_updater_keys_util.GenerateKeys(config)

  FinalizeConfigInit(
      config,
      token,
      admin_password=admin_password,
      redownload_templates=redownload_templates,
      repack_templates=repack_templates,
      prompt=True)
447088
private function initSession()
    {
        $transport = $this->transportRegistry->getTransport($this->profile->get('transport', 'name'));
        $repository = $transport->getRepository($this->profile->get('transport'));

        $credentials = new SimpleCredentials(
            $this->profile->get('phpcr', 'username'),
            $this->profile->get('phpcr', 'password')
        );

        $session = $repository->login($credentials, $this->profile->get('phpcr', 'workspace'));

        // if you are wondering wtf here -- we wrap the PhpcrSession
        if (!$this->session) {
            $this->session = new PhpcrSession($session);
        } else {
            $this->session->setPhpcrSession($session);
        }
    }
606542
private function init()
    {
        $nb_engine = CNabuEngine::getEngine();

        $session_name = session_name();
        $nb_engine->traceLog("Session Name", $session_name);
        if (array_key_exists($session_name, $_GET)) {
            $sessid = filter_input(INPUT_GET, $session_name);
            if (preg_match('/^[a-zA-Z0-9]{26}$/', $sessid)) {
                session_id($sessid);
                $nb_engine->traceLog("Session source", "GET");
            } else {
                $nb_engine->traceLog("Session source", "COOKIE");
            }
        } else {
            $nb_engine->traceLog("Session source", "COOKIE");
        }
    }
312385
def reset (self):
        
        super(HttpUrl, self).reset()
        # initialize check data
        # server headers
        self.headers = {}
        self.auth = None
        self.ssl_cipher = None
        self.ssl_cert = None