Skip to content

Commit

Permalink
webservice MDL-17135 Add some Zend library needed for Amf + add one l…
Browse files Browse the repository at this point in the history
…ine in order to set amf server in development mode
  • Loading branch information
mouneyrac committed Nov 11, 2009
1 parent 35fb85a commit 64906d3
Show file tree
Hide file tree
Showing 7 changed files with 801 additions and 1 deletion.
169 changes: 169 additions & 0 deletions lib/zend/Zend/Auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Auth
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/


/**
* @category Zend
* @package Zend_Auth
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Auth
{
/**
* Singleton instance
*
* @var Zend_Auth
*/
protected static $_instance = null;

/**
* Persistent storage handler
*
* @var Zend_Auth_Storage_Interface
*/
protected $_storage = null;

/**
* Singleton pattern implementation makes "new" unavailable
*
* @return void
*/
protected function __construct()
{}

/**
* Singleton pattern implementation makes "clone" unavailable
*
* @return void
*/
protected function __clone()
{}

/**
* Returns an instance of Zend_Auth
*
* Singleton pattern implementation
*
* @return Zend_Auth Provides a fluent interface
*/
public static function getInstance()
{
if (null === self::$_instance) {
self::$_instance = new self();
}

return self::$_instance;
}

/**
* Returns the persistent storage handler
*
* Session storage is used by default unless a different storage adapter has been set.
*
* @return Zend_Auth_Storage_Interface
*/
public function getStorage()
{
if (null === $this->_storage) {
/**
* @see Zend_Auth_Storage_Session
*/
require_once 'Zend/Auth/Storage/Session.php';
$this->setStorage(new Zend_Auth_Storage_Session());
}

return $this->_storage;
}

/**
* Sets the persistent storage handler
*
* @param Zend_Auth_Storage_Interface $storage
* @return Zend_Auth Provides a fluent interface
*/
public function setStorage(Zend_Auth_Storage_Interface $storage)
{
$this->_storage = $storage;
return $this;
}

/**
* Authenticates against the supplied adapter
*
* @param Zend_Auth_Adapter_Interface $adapter
* @return Zend_Auth_Result
*/
public function authenticate(Zend_Auth_Adapter_Interface $adapter)
{
$result = $adapter->authenticate();

/**
* ZF-7546 - prevent multiple succesive calls from storing inconsistent results
* Ensure storage has clean state
*/
if ($this->hasIdentity()) {
$this->clearIdentity();
}

if ($result->isValid()) {
$this->getStorage()->write($result->getIdentity());
}

return $result;
}

/**
* Returns true if and only if an identity is available from storage
*
* @return boolean
*/
public function hasIdentity()
{
return !$this->getStorage()->isEmpty();
}

/**
* Returns the identity from storage or null if no identity is available
*
* @return mixed|null
*/
public function getIdentity()
{
$storage = $this->getStorage();

if ($storage->isEmpty()) {
return null;
}

return $storage->read();
}

/**
* Clears the identity from persistent storage
*
* @return void
*/
public function clearIdentity()
{
$this->getStorage()->clear();
}
}
35 changes: 35 additions & 0 deletions lib/zend/Zend/Loader/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Loader
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/

/**
* @see Zend_Exception
*/
require_once 'Zend/Exception.php';

/**
* @category Zend
* @package Zend_Loader
* @uses Zend_Exception
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Loader_Exception extends Zend_Exception
{}
Loading

0 comments on commit 64906d3

Please sign in to comment.