split authentication required and secured controllers
This commit is contained in:
6 files changed
+45
-37
No files matched your search
@@ -7,14 +7,14 @@ use RVR\PersistentData\Model\User;
|
||||
use RVR\Repository\CommunityRepository;
|
||||
use RVR\Repository\CommunityMemberRepository;
|
||||
use RVR\Repository\UserRepository;
|
||||
use SokoWeb\Interfaces\Authorization\ISecured;
|
||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||
use SokoWeb\Interfaces\Request\IRequest;
|
||||
use SokoWeb\Interfaces\Response\IContent;
|
||||
use SokoWeb\PersistentData\PersistentDataManager;
|
||||
use SokoWeb\Response\HtmlContent;
|
||||
use SokoWeb\Response\JsonContent;
|
||||
|
||||
class CommunityController implements ISecured
|
||||
class CommunityController implements IAuthenticationRequired
|
||||
{
|
||||
private IRequest $request;
|
||||
|
||||
@@ -35,9 +35,9 @@ class CommunityController implements ISecured
|
||||
$this->communityMemberRepository = new CommunityMemberRepository();
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
public function isAuthenticationRequired(): bool
|
||||
{
|
||||
return $this->request->user() !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getCommunityHome(): ?IContent
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
use RVR\PersistentData\Model\User;
|
||||
use RVR\Repository\CommunityMemberRepository;
|
||||
use SokoWeb\Interfaces\Authorization\ISecured;
|
||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||
use SokoWeb\Interfaces\Request\IRequest;
|
||||
use SokoWeb\Interfaces\Response\IContent;
|
||||
use SokoWeb\Response\HtmlContent;
|
||||
|
||||
class HomeController implements ISecured
|
||||
class HomeController implements IAuthenticationRequired
|
||||
{
|
||||
private IRequest $request;
|
||||
|
||||
@@ -19,9 +19,9 @@ class HomeController implements ISecured
|
||||
$this->communityMemberRepository = new CommunityMemberRepository();
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
public function isAuthenticationRequired(): bool
|
||||
{
|
||||
return $this->request->user() !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getHome(): IContent
|
||||
|
||||
@@ -4,14 +4,14 @@ use DateTime;
|
||||
use RVR\PersistentData\Model\OAuthToken;
|
||||
use RVR\PersistentData\Model\User;
|
||||
use RVR\Repository\OAuthClientRepository;
|
||||
use SokoWeb\Interfaces\Authorization\ISecured;
|
||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||
use SokoWeb\Interfaces\Request\IRequest;
|
||||
use SokoWeb\Interfaces\Response\IRedirect;
|
||||
use SokoWeb\Response\Redirect;
|
||||
use SokoWeb\PersistentData\PersistentDataManager;
|
||||
use SokoWeb\Response\HtmlContent;
|
||||
|
||||
class OAuthAuthController implements ISecured
|
||||
class OAuthAuthController implements IAuthenticationRequired
|
||||
{
|
||||
private IRequest $request;
|
||||
|
||||
@@ -26,9 +26,9 @@ class OAuthAuthController implements ISecured
|
||||
$this->oAuthClientRepository = new OAuthClientRepository();
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
public function isAuthenticationRequired(): bool
|
||||
{
|
||||
return $this->request->user() !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function auth()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use DateTime;
|
||||
use SokoWeb\Http\Request;
|
||||
use SokoWeb\Interfaces\Authorization\ISecured;
|
||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||
use SokoWeb\Interfaces\Request\IRequest;
|
||||
use SokoWeb\Interfaces\Response\IContent;
|
||||
use SokoWeb\Interfaces\Response\IRedirect;
|
||||
@@ -15,7 +15,7 @@ use SokoWeb\Response\Redirect;
|
||||
use SokoWeb\Util\JwtParser;
|
||||
use RVR\Repository\UserRepository;
|
||||
|
||||
class UserController implements ISecured
|
||||
class UserController implements IAuthenticationRequired
|
||||
{
|
||||
private IRequest $request;
|
||||
|
||||
@@ -30,9 +30,9 @@ class UserController implements ISecured
|
||||
$this->userRepository = new UserRepository();
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
public function isAuthenticationRequired(): bool
|
||||
{
|
||||
return $this->request->user() !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getAccount(): IContent
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php namespace RVR\Controller;
|
||||
|
||||
use RVR\Repository\UserRepository;
|
||||
use SokoWeb\Interfaces\Authorization\ISecured;
|
||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||
use SokoWeb\Interfaces\Request\IRequest;
|
||||
use SokoWeb\Interfaces\Response\IContent;
|
||||
use SokoWeb\Response\JsonContent;
|
||||
|
||||
class UserSearchController implements ISecured
|
||||
class UserSearchController implements IAuthenticationRequired
|
||||
{
|
||||
private IRequest $request;
|
||||
|
||||
@@ -18,9 +18,9 @@ class UserSearchController implements ISecured
|
||||
$this->userRepository = new UserRepository();
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
public function isAuthenticationRequired(): bool
|
||||
{
|
||||
return $this->request->user() !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function searchUser(): IContent
|
||||
|
||||
Reference in new issue
Block a user