summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-15 20:56:01 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-15 20:56:01 -0400
commit4eaab1f6da1a56376a840231f7b8a10469308f97 (patch)
tree8f96f9f7562c69b19a2faf53923b5ba9cdb51397 /app
parent8a6f02735b628033a3284d06a9f633bd260e19ef (diff)
Added unit tests for middleware
Diffstat (limited to 'app')
-rw-r--r--app/Core/Controller/BaseMiddleware.php2
-rw-r--r--app/Core/Helper.php2
-rw-r--r--app/Middleware/AuthenticationMiddleware.php6
-rw-r--r--app/Middleware/PostAuthenticationMiddleware.php2
4 files changed, 6 insertions, 6 deletions
diff --git a/app/Core/Controller/BaseMiddleware.php b/app/Core/Controller/BaseMiddleware.php
index 233843c9..e94ad95c 100644
--- a/app/Core/Controller/BaseMiddleware.php
+++ b/app/Core/Controller/BaseMiddleware.php
@@ -25,7 +25,7 @@ abstract class BaseMiddleware extends Base
/**
* Set next middleware
*
- * @param BaseMiddleware|null $nextMiddleware
+ * @param BaseMiddleware $nextMiddleware
* @return BaseMiddleware
*/
public function setNextMiddleware(BaseMiddleware $nextMiddleware)
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 66f8d429..f34b6190 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -94,7 +94,7 @@ class Helper
{
$container = $this->container;
- $this->helpers[$property] = function() use($className, $container) {
+ $this->helpers[$property] = function() use ($className, $container) {
return new $className($container);
};
diff --git a/app/Middleware/AuthenticationMiddleware.php b/app/Middleware/AuthenticationMiddleware.php
index a31198a5..c29b7ab6 100644
--- a/app/Middleware/AuthenticationMiddleware.php
+++ b/app/Middleware/AuthenticationMiddleware.php
@@ -33,7 +33,7 @@ class AuthenticationMiddleware extends BaseMiddleware
protected function handleAuthentication()
{
if (! $this->userSession->isLogged() && ! $this->authenticationManager->preAuthentication()) {
- $this->setNextMiddleware(null);
+ $this->nextMiddleware = null;
if ($this->request->isAjax()) {
$this->response->text('Not Authorized', 401);
@@ -44,10 +44,10 @@ class AuthenticationMiddleware extends BaseMiddleware
}
}
- private function isPublicAccess()
+ protected function isPublicAccess()
{
if ($this->applicationAuthorization->isAllowed($this->router->getController(), $this->router->getAction(), Role::APP_PUBLIC)) {
- $this->setNextMiddleware(null);
+ $this->nextMiddleware = null;
return true;
}
diff --git a/app/Middleware/PostAuthenticationMiddleware.php b/app/Middleware/PostAuthenticationMiddleware.php
index 8287c10e..c1237f47 100644
--- a/app/Middleware/PostAuthenticationMiddleware.php
+++ b/app/Middleware/PostAuthenticationMiddleware.php
@@ -22,7 +22,7 @@ class PostAuthenticationMiddleware extends BaseMiddleware
$ignore = ($controller === 'twofactor' && in_array($action, array('code', 'check'))) || ($controller === 'auth' && $action === 'logout');
if ($ignore === false && $this->userSession->hasPostAuthentication() && ! $this->userSession->isPostAuthenticationValidated()) {
- $this->setNextMiddleware(null);
+ $this->nextMiddleware = null;
if ($this->request->isAjax()) {
$this->response->text('Not Authorized', 401);