Revision: 200
http://sourceforge.net/p/beeframework/code/200
Author: m_plomer
Date: 2014-08-27 18:10:47 +0000 (Wed, 27 Aug 2014)
Log Message:
-----------
- cleaned up Authentication Providers, fixed wrong exception class names
Modified Paths:
--------------
branches/0.9-dev/framework/Bee/Security/AbstractAuthenticationManager.php
branches/0.9-dev/framework/Bee/Security/IAuthenticationProvider.php
branches/0.9-dev/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php
branches/0.9-dev/framework/Bee/Security/Provider/AnonymousAuthentication.php
branches/0.9-dev/framework/Bee/Security/Provider/DaoAuthentication.php
branches/0.9-dev/framework/Bee/Security/Provider/Manager.php
Modified: branches/0.9-dev/framework/Bee/Security/AbstractAuthenticationManager.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/AbstractAuthenticationManager.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/AbstractAuthenticationManager.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -20,14 +20,14 @@
/**
* Enter description here...
*
- * @var booelan
+ * @var boolean
*/
private $clearExtraInformation;
public final function authenticate(Bee_Security_IAuthentication $authentication) {
try {
return $this->doAuthentication($authentication);
- } catch (Bee_Security_AuthenticationException $e) {
+ } catch (Bee_Security_Exception_Authentication $e) {
$e->setAuthentication($authentication);
if ($this->clearExtraInformation) {
@@ -43,7 +43,7 @@
*
* @param Bee_Security_IAuthentication $authentication
*
- * @throws Bee_Security_AuthenticationException
+ * @throws Bee_Security_Exception_Authentication
*/
protected abstract function doAuthentication(Bee_Security_IAuthentication $authentication);
@@ -60,5 +60,4 @@
$this->clearExtraInformation = $clearExtraInformation;
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
Modified: branches/0.9-dev/framework/Bee/Security/IAuthenticationProvider.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/IAuthenticationProvider.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/IAuthenticationProvider.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -31,7 +31,7 @@
* <code>Authentication</code> object. In such a case, the next <code>AuthenticationProvider</code> that
* supports the presented <code>Authentication</code> class will be tried.
*
- * @throws Bee_Security_AuthenticationException if authentication fails.
+ * @throws Bee_Security_Exception_Authentication if authentication fails.
*/
function authenticate(Bee_Security_IAuthentication $authentication);
@@ -43,4 +43,3 @@
*/
function supports($authenticationClass);
}
-?>
\ No newline at end of file
Modified: branches/0.9-dev/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -41,7 +41,7 @@
* @param Bee_Security_IUserDetails $userDetails
* @param Bee_Security_UsernamePasswordAuthenticationToken $authentication
*
- * @throws Bee_Security_AuthenticationException
+ * @throws Bee_Security_Exception_Authentication
*/
protected abstract function additionalAuthenticationChecks(Bee_Security_IUserDetails $userDetails,
Bee_Security_UsernamePasswordAuthenticationToken $authentication);
@@ -67,18 +67,24 @@
}
}
- /**
- * Enter description here...
- *
- * @param Bee_Security_IAuthentication $authentication
- * @return Bee_Security_IAuthentication
- */
+ /**
+ * Enter description here...
+ *
+ * @param Bee_Security_IAuthentication $authentication
+ * @throws Bee_Security_Exception_AccountStatus
+ * @throws Bee_Security_Exception_Authentication
+ * @throws Bee_Security_Exception_BadCredentials
+ * @throws Bee_Security_Exception_UsernameNotFound
+ * @throws Exception
+ * @return Bee_Security_IAuthentication
+ */
public final function authenticate(Bee_Security_IAuthentication $authentication) {
Bee_Utils_Assert::isInstanceOf('Bee_Security_UsernamePasswordAuthenticationToken', $authentication, 'Only UsernamePasswordAuthenticationToken is supported');
+ /** @var Bee_Security_UsernamePasswordAuthenticationToken $authentication */
// Determine username
- $username = is_null($authentication->getPrincipal()) ? "NONE_PROVIDED" : $authentication->getName();
+ $username = is_null($authentication->getPrincipal()) ? "NONE_PROVIDED" : $authentication->getPrincipal()->getName();
$cacheWasUsed = true;
$user = null;
@@ -109,7 +115,7 @@
if ($cacheWasUsed) {
// There was a problem, so try again after checking
// we're using latest data (ie not from the cache)
- $cacheWasUsed = false;
+// $cacheWasUsed = false;
$user = $this->retrieveUser($username, $authentication);
$this->additionalAuthenticationChecks($user, $authentication);
} else {
@@ -138,12 +144,12 @@
* <p>Subclasses will usually store the original credentials the user supplied (not salted or encoded
* passwords) in the returned <code>Bee_Security_IAuthentication</code> object.</p>
*
- * @param principal that should be the principal in the returned object (defined by the {@link
+ * @param mixed $principal that should be the principal in the returned object (defined by the {@link
* #isForcePrincipalAsString()} method)
- * @param authentication that was presented to the provider for validation
- * @param user that was loaded by the implementation
+ * @param Bee_Security_IAuthentication $authentication that was presented to the provider for validation
+ * @param Bee_Security_IUserDetails $user that was loaded by the implementation
*
- * @return the successful authentication token
+ * @return Bee_Security_UsernamePasswordAuthenticationToken the successful authentication token
*/
protected function createSuccessAuthentication($principal, Bee_Security_IAuthentication $authentication, Bee_Security_IUserDetails $user) {
// Ensure we return the original credentials the user supplied,
@@ -231,6 +237,4 @@
public function setForcePrincipalAsString($forcePrincipalAsString) {
$this->forcePrincipalAsString = $forcePrincipalAsString;
}
-
}
-?>
\ No newline at end of file
Modified: branches/0.9-dev/framework/Bee/Security/Provider/AnonymousAuthentication.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/Provider/AnonymousAuthentication.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/Provider/AnonymousAuthentication.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -22,7 +22,6 @@
* Time: 9:10:57 PM
* To change this template use File | Settings | File Templates.
*/
-
class Bee_Security_Provider_AnonymousAuthentication implements Bee_Security_IAuthenticationProvider {
private $key;
@@ -33,6 +32,7 @@
if (!$this->supports($authentication)) {
return null;
}
+ /** @var Bee_Security_AnonymousAuthenticationToken $authentication */
if (hash('md5', $this->key) != $authentication->getKeyHash()) {
throw new Bee_Security_Exception_BadCredentials('The presented AnonymousAuthenticationToken does not contain the expected key');
@@ -53,4 +53,3 @@
return Bee_Utils_Types::isAssignable($authenticationClass, 'Bee_Security_AnonymousAuthenticationToken');
}
}
-?>
\ No newline at end of file
Modified: branches/0.9-dev/framework/Bee/Security/Provider/DaoAuthentication.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/Provider/DaoAuthentication.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/Provider/DaoAuthentication.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -137,4 +137,3 @@
$this->userDetailsService = $userDetailsService;
}
}
-?>
\ No newline at end of file
Modified: branches/0.9-dev/framework/Bee/Security/Provider/Manager.php
===================================================================
--- branches/0.9-dev/framework/Bee/Security/Provider/Manager.php 2014-08-27 18:05:48 UTC (rev 199)
+++ branches/0.9-dev/framework/Bee/Security/Provider/Manager.php 2014-08-27 18:10:47 UTC (rev 200)
@@ -28,7 +28,7 @@
/**
* Enter description here...
*
- * @var array
+ * @var Bee_Security_IAuthenticationProvider[]
*/
private $providers = array();
@@ -128,5 +128,4 @@
public final function setSessionController(Bee_Security_Concurrent_ISessionController $sessionController) {
$this->sessionController = $sessionController;
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|