/** * Do not call directly. Use Session::getNamespace(). */ private function start() { if ($this->meta === FALSE) { $this->session->start(); $this->data =& $_SESSION['__NF']['DATA'][$this->name]; $this->meta =& $_SESSION['__NF']['META'][$this->name]; } }
protected function prepareForTests() { parent::prepareForTests(); Route::enableFilters(); $this->current_realm = Config::get('app.url'); $user = User::where('identifier', '=', 'sebastian.marcet')->first(); $this->be($user); Session::start(); $scope = $this->getScopes(); $this->client_id = 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client'; $this->client_secret = 'ITc/6Y5N7kOtGKhg'; $params = array('client_id' => $this->client_id, 'redirect_uri' => 'https://www.test.com/oauth2', 'response_type' => OAuth2Protocol::OAuth2Protocol_ResponseType_Code, 'scope' => implode(' ', $scope), OAuth2Protocol::OAuth2Protocol_AccessType => OAuth2Protocol::OAuth2Protocol_AccessType_Offline); Session::set("openid.authorization.response", IAuthService::AuthorizationResponse_AllowOnce); $response = $this->action("POST", "OAuth2ProviderController@authorize", $params, array(), array(), array()); $status = $response->getStatusCode(); $url = $response->getTargetUrl(); $content = $response->getContent(); $comps = @parse_url($url); $query = $comps['query']; $output = array(); parse_str($query, $output); $params = array('code' => $output['code'], 'redirect_uri' => 'https://www.test.com/oauth2', 'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_AuthCode); $response = $this->action("POST", "OAuth2ProviderController@token", $params, array(), array(), array("HTTP_Authorization" => " Basic " . base64_encode($this->client_id . ':' . $this->client_secret))); $status = $response->getStatusCode(); $this->assertResponseStatus(200); $content = $response->getContent(); $response = json_decode($content); $access_token = $response->access_token; $refresh_token = $response->refresh_token; $this->access_token = $access_token; }
public static function admin_logged() { Session::start(); if (Session::get('user') === null) { Tools::redirect('/admin/login'); } }
public function testDeleteDeveloper() { Session::start(); $response = $this->call('DELETE', '/developer/2', ['_token' => csrf_token()]); $this->assertEquals(302, $response->getStatusCode()); $this->notSeeInDatabase('companies', ['deleted_at' => null, 'id' => 1]); }
public function setUp() { parent::setUp(); Session::start(); $this->app->instance('middleware.disable', true); $this->mock = $this->mock('App\\Interfaces\\ProductInterface'); }
static function iqWrapper($xml = false, $to = false, $type = false, $id = false) { $session = \Session::start(); $dom = new \DOMDocument('1.0', 'UTF-8'); $iq = $dom->createElementNS('jabber:client', 'iq'); $dom->appendChild($iq); if ($to != false) { $iq->setAttribute('to', $to); } if ($type != false) { $iq->setAttribute('type', $type); } global $language; if ($id == false) { $id = $session->get('id'); } $iq->setAttribute('id', $id); if (isset($language)) { $iq->setAttribute('xml:lang', $language); } if (isset($session->user)) { $iq->setAttribute('from', $session->get('username') . '@' . $session->get('host') . '/' . $session->get('resource')); } if ($xml != false) { if (is_string($xml)) { $f = $dom->createDocumentFragment(); $f->appendXML($xml); $iq->appendChild($f); } else { $xml = $dom->importNode($xml, true); $iq->appendChild($xml); } } return $dom->saveXML($dom->documentElement); }
/** * Test expiration of namespaces and namespace variables. * @return void */ public function testSetExpiration() { // try to expire whole namespace $s = $this->session->getNamespace('expire'); $s->a = 'apple'; $s->p = 'pear'; $s['o'] = 'orange'; $s->setExpiration('+ 5 seconds'); $this->session->close(); sleep(6); $this->session->start(); $s = $this->session->getNamespace('expire'); $result = $this->serialize($s->getIterator()); $this->assertEquals('', $result, 'iteration over named Session namespace failed'); // try to expire only 1 of the keys $s = $this->session->getNamespace('expireSingle'); $s->setExpiration(5, 'g'); $s->g = 'guava'; $s->p = 'plum'; $this->session->close(); sleep(6); $this->session->start(); $s = $this->session->getNamespace('expireSingle'); $result = $this->serialize($s->getIterator()); $this->assertEquals('p=plum;', $result, 'iteration over named Session namespace failed'); }
/** * * Resumes a previous session, or starts a new one, and loads the segment. * * @return null * */ protected function resumeOrStartSession() { if (!$this->resumeSession()) { $this->session->start(); $this->load(); } }
static function login($data) { if (!isset($data["username"])) { return self::UM_NoUserError; } else { $u = false; $logged = false; //check nick and password $u = self::loadUserByNickname($data["username"]); // assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) { $logged = true; } if ($u === false) { //check mail and password $u = self::loadUserByMail($data["username"]); // assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) { header("location: " . FileManager::appendToRootPath()); } } if ($u !== false) { if ($logged) { if (Session::start($u)) { return true; } else { return self::UM_NoSessionError; } } return self::UM_NoPasswordError; } return self::UM_NoUserError; } }
public function bootstrap() { $this->constant(); //加载服务配置项 $servers = (require __DIR__ . '/service.php'); $config = (require ROOT_PATH . '/system/config/service.php'); $servers['providers'] = array_merge($config['providers'], $servers['providers']); $servers['facades'] = array_merge($config['facades'], $servers['facades']); $this->servers = $servers; //自动加载系统服务 Loader::register([$this, 'autoload']); //绑定核心服务提供者 $this->bindServiceProvider(); //添加初始实例 $this->instance('App', $this); //设置外观类APP属性 ServiceFacade::setFacadeApplication($this); //启动服务 $this->boot(); //定义错误/异常处理 Error::bootstrap(); //命令行模式 IS_CLI and die(Cli::bootstrap()); //导入类库别名 Loader::addMap(c('app.alias')); //自动加载文件 Loader::autoloadFile(); //开启会话 Session::start(); //执行全局中间件 Middleware::globals(); //解析路由 Route::dispatch(); }
public function setUp() { parent::setUp(); Artisan::call('migrate'); Artisan::call('db:seed'); Session::start(); }
/** * set up start */ public function setUp() { parent::setUp(); Session::start(); // $this->mock = Mockery::mock('\App\Group'); $this->id_test = Module::all()->first()->id; }
function __construct() { global $_G; parent::__construct(); loadLib('Session'); Session::start(db(), "{$_G['db_prefix']}session"); }
public function testMinification() { Session::start(); $response = $this->post('process', ['html' => '<p><!--This is a comment--></p>', '_token' => csrf_token()])->withoutMiddleware(); $this->assertResponseOk(); $this->assertJson('{"html": "<p></p>"}'); }
public static function run() { Connection::connect(); Session::start(); Router::run(); Connection::disconnect(); }
public function setup() { parent::setup(); Session::start(); $this->app["request"]->setSession(Session::driver()); FieldPresenter::presenter(null); }
public function handle($stanza, $parent = false) { $mec = (array) $stanza->mechanism; /* * Weird behaviour on old eJabberd servers, fixed on the new versions * see https://github.com/processone/ejabberd/commit/2d748115 */ if (isset($parent->starttls) && isset($parent->starttls->required)) { return; } $session = \Session::start(); $user = $session->get('username'); if ($user) { if (!is_array($mec)) { $mec = array($mec); } $mecchoice = str_replace('-', '', \Moxl\Auth::mechanismChoice($mec)); $session->set('mecchoice', $mecchoice); \Moxl\Utils::log("/// MECANISM CHOICE " . $mecchoice); if (method_exists('\\Moxl\\Auth', 'mechanism' . $mecchoice)) { call_user_func('Moxl\\Auth::mechanism' . $mecchoice); } else { \Moxl\Utils::log("/// MECANISM CHOICE NOT FOUND"); } } else { $g = new Get(); $g->setTo($session->get('host'))->request(); } }
/** * Ensure we populate these fields before a save. */ public function onBeforeWrite() { // Run other beforewrites first. parent::onBeforeWrite(); if (!$this->isBrowser()) { return false; } // If this is the first save... if (!$this->ID) { // Ensure the session exists before querying it. if (!Session::request_contains_session_id()) { Session::start(); } // Store the sesion and has information in the database. $this->SessionID = SecurityToken::getSecurityID(); if (is_null($this->SessionID)) { return false; } $gen = new RandomGenerator(); $uniqueurl = substr($gen->randomToken(), 0, 32); while (ShortList::get()->filter('URL', $uniqueurl)->count() > 0) { $uniqueurl = substr($gen->randomToken(), 0, 32); } $this->URL = $uniqueurl; $this->UserAgent = Controller::curr()->getRequest()->getHeader('User-Agent'); } }
static function server() { $session = \Session::start(); $dom = new \DOMDocument('1.0', 'UTF-8'); $ping = $dom->createElementNS('urn:xmpp:ping', 'ping'); \Moxl\API::request(\Moxl\API::iqWrapper($ping, $session->get('host'), 'get')); }
/** * Constructor. * * @access protected */ protected function __construct() { // Init Config Config::init(); // Turn on output buffering ob_start(); // Display Errors Config::get('system.errors.display') and error_reporting(-1); // Set internal encoding function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset')); function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset')); // Set default timezone date_default_timezone_set(Config::get('system.timezone')); // Start the session Session::start(); // Init Cache Cache::init(); // Init Plugins Plugins::init(); // Init Blocks Blocks::init(); // Init Pages Pages::init(); // Flush (send) the output buffer and turn off output buffering ob_end_flush(); }
public function __construct() { parent::__construct(); Session::start(); Session::unregister(); Response::setRedirect('/ingresar'); }
/** * @runInSeparateProcess */ public function testSessionStart() { $session = new Session(); $session->start(); $this->assertEquals(null, $session->getHash()); $this->assertEquals(null, $session->getAddress()); $this->assertEquals(true, $session->isActive()); }
/** * Default preparations for tests * * @return void */ public function setup() { parent::setUp(); Artisan::call('migrate'); Artisan::call('db:seed'); Session::start(); $this->setVariables(); }
/** * This will run at the beginning of every test method */ public function setUp() { // Parent setup parent::SetUp(); Session::start(); // Instantiate SocialHelper class $this->viewHelper = new viewHelper(); }
public function init() { parent::init(); Session::start(); if ($this->request->getVar('page')) { $this->currentPage = $this->request->getVar('page'); } }
/** * @runInSeparateProcess */ public function testSetAndGetAndRegenerateId() { Session::start(); Session::setId('1ab2c3d4e5f6g7h8i9'); $this->assertEquals('1ab2c3d4e5f6g7h8i9', Session::getId()); Session::regenerateId(); $this->assertNotEquals('1ab2c3d4e5f6g7h8i9', Session::getId()); }
/** * Creates the application. * * @return \Symfony\Component\HttpKernel\HttpKernelInterface */ public function createApplication() { $unitTesting = true; $testEnvironment = 'testing'; return require __DIR__ . '/../../bootstrap/start.php'; Session::start(); Route::enableFilters(); }
/** @test */ public function startShouldSendWrapperMethodsToOtherParty() { $dog = new Dog(); $session = new Session(0, $dog); $expected = array('method' => 'methods', 'arguments' => array($dog), 'callbacks' => array(array(0, 'bark'), array(0, 'meow')), 'links' => array()); $session->on('request', $this->expectCallableOnceWithArg($expected)); $session->start(); }
public function setUp() { parent::setUp(); Artisan::call('migrate'); Artisan::call('db:seed'); Session::start(); $this->withoutMiddleware(); }
/** * Generate a security token. * */ public static function getSecurityToken() { // Ensure the session exists before querying it. if (!Session::request_contains_session_id()) { Session::start(); } return SecurityToken::inst()->getSecurityID(); }