westdc-zf1/vendor/Sookon/Helpers/Auth.php

33 lines
664 B
PHP

<?php
namespace Sookon\Helpers;
use \Zend\Authentication\AuthenticationService;
use \Zend\Authentication\Storage\Session as SessionStorage;
use \Sookon\Helpers\Config;
class Auth
{
public $auth;
function __construct($getAuthService = false)
{
$config = Config::get();
$this->auth = new AuthenticationService();
$this->auth->setStorage(new SessionStorage($config->session_namespace));
}
public function getInstance()
{
return $this->auth;
}
public function clearIndentity()
{
return $this->auth->clearIdentity();
}
public function getIdentity($field)
{
return $this->auth->getIdentity()->$field;
}
}