Changeset 756
- Timestamp:
- 07/09/07 23:45:34 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/auth/storage/stubAuthAbstractStorage.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/auth/storage/stubAuthSessionStorage.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/auth/strategy/stubAuthFailOverStrategy.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/auth/strategy/stubAuthOrStrategy.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/auth/stubAuth.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/auth (added)
- trunk/src/test/php/net/stubbles/auth/AuthTestSuite.php (added)
- trunk/src/test/php/net/stubbles/auth/storage (added)
- trunk/src/test/php/net/stubbles/auth/storage/stubAuthSessionStorageTestCase.php (added)
- trunk/src/test/php/net/stubbles/auth/strategy (added)
- trunk/src/test/php/net/stubbles/auth/strategy/stubAuthFailOverStrategyTestCase.php (added)
- trunk/src/test/php/net/stubbles/auth/strategy/stubAuthOrStrategyTestCase.php (added)
- trunk/src/test/php/net/stubbles/auth/strategy/stubAuthStrategyBaseTestCase.php (added)
- trunk/src/test/php/net/stubbles/auth/stubAuthTestCase.php (added)
- trunk/src/test/run.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/auth/storage/stubAuthAbstractStorage.php
r755 r756 22 22 * @var int 23 23 */ 24 protected $timeout = 3600;24 protected $timeout = 3600; 25 25 26 26 /** … … 71 71 public function setResult(stubAuthResult $result) 72 72 { 73 $this->doSetResult($result, $this->storetime);73 $this->doSetResult($result, time()); 74 74 } 75 75 trunk/src/main/php/net/stubbles/auth/storage/stubAuthSessionStorage.php
r755 r756 7 7 * @subpackage auth_storage 8 8 */ 9 stubClassLoader::load('net.stubbles.auth.storage.stubAuthStorage'); 9 stubClassLoader::load('net.stubbles.auth.storage.stubAuthAbstractStorage', 10 'net.stubbles.ipo.session.stubSession' 11 ); 10 12 /** 11 13 * Storage that stores the authentication result within the session. … … 64 66 public function getResult() 65 67 { 66 $this->session->getValue('net.stubbles.auth.result');68 return $this->session->getValue('net.stubbles.auth.result'); 67 69 } 68 70 trunk/src/main/php/net/stubbles/auth/strategy/stubAuthFailOverStrategy.php
r754 r756 10 10 /** 11 11 * Authentication strategy that uses the first authenticator and the other only if the first fails. 12 * 13 * The first result which status is not stubAuthResult::STATUS_AUTHENTICATOR_FAILURE 14 * will be returned. This means even if the first authenticator says the 15 * credentials are invalid and the second authenticator would say the attempt 16 * is successfull the authentication will fail because the first result will be 17 * returned. 18 * Only if all authenticators fail the result will be of status 19 * stubAuthResult::STATUS_AUTHENTICATOR_FAILURE. 12 20 * 13 21 * @package stubbles trunk/src/main/php/net/stubbles/auth/strategy/stubAuthOrStrategy.php
r754 r756 10 10 /** 11 11 * Authentication strategy that tries all authenticators until one was successful or all have been used. 12 * 13 * If the authentication fails because none of the authenticator succeeds 14 * (independend of internal failure or invalid credentials) only the result 15 * of the last authenticator will be returned. 12 16 * 13 17 * @package stubbles trunk/src/main/php/net/stubbles/auth/stubAuth.php
r755 r756 103 103 104 104 /** 105 * destroys the instance if it exists 106 * 107 * @param string $id id of the auth instance to destroy 108 */ 109 public static function destroyInstance($id = self::ID_DEFAULT) 110 { 111 if (isset(self::$instances[$id]) == true) { 112 unset(self::$instances[$id]); 113 } 114 } 115 116 /** 105 117 * checks if the specified auth instances contains a valid authentification 106 118 * … … 162 174 * authenticate the credentials 163 175 * 164 * @param mixed $credentials176 * @param mixed $credentials 165 177 * @return stubAuthStorage 178 * @throws stubAuthException in case no authenticators have been added 166 179 */ 167 180 public function authenticate($credentials) 168 181 { 169 $this->storage->setResult($this->authentificationStrategy->authenticate($this->authenticators, $credentials)); 182 if (count($this->authenticators) == 0) { 183 throw new stubAuthException('Please add at least one authenticator before trying to authenticate some credentials.'); 184 } 185 186 $this->storage->setResult($this->strategy->authenticate($this->authenticators, $credentials)); 170 187 return $this->storage; 171 188 } trunk/src/test/run.php
r740 r756 32 32 33 33 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/stubTestSuite.php'); 34 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/auth/AuthTestSuite.php'); 34 35 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/events/EventTestSuite.php'); 35 36 $testSuite->addTestFile(TEST_SRC_PATH . '/php/net/stubbles/ioc/IOCTestSuite.php');
