auth = new AuthenticationService(); $this->auth->setStorage(new SessionStorage($config->session_namespace)); } public function getInstance() { return $this->auth; } public function clearIndentity() { $this->auth->clearIdentity(); return true; } public function getIdentity($field = "") { if(empty($field)) return $this->auth->getIdentity(); if(isset($this->auth->getIdentity()->$field)) return $this->auth->getIdentity()->$field; else return null; } public function write($user) { if(is_array($user)) $user = (object)$user; $this->auth->getStorage()->write($user); } }