diff --git a/src/Authentication/AuthenticationException.php b/src/Authentication/AuthenticationException.php index d1311a039..75806ebf2 100644 --- a/src/Authentication/AuthenticationException.php +++ b/src/Authentication/AuthenticationException.php @@ -3,9 +3,9 @@ namespace CodeIgniter\Shield\Authentication; use CodeIgniter\HTTP\Exceptions\HTTPException; -use Exception; +use CodeIgniter\Shield\Exceptions\RuntimeException; -class AuthenticationException extends Exception +class AuthenticationException extends RuntimeException { protected $code = 403; diff --git a/src/Authentication/Authenticators/AccessTokens.php b/src/Authentication/Authenticators/AccessTokens.php index 1c6884475..3bf64f587 100644 --- a/src/Authentication/Authenticators/AccessTokens.php +++ b/src/Authentication/Authenticators/AccessTokens.php @@ -7,11 +7,11 @@ use CodeIgniter\Shield\Authentication\AuthenticationException; use CodeIgniter\Shield\Authentication\AuthenticatorInterface; use CodeIgniter\Shield\Entities\User; +use CodeIgniter\Shield\Exceptions\InvalidArgumentException; use CodeIgniter\Shield\Models\TokenLoginModel; use CodeIgniter\Shield\Models\UserIdentityModel; use CodeIgniter\Shield\Models\UserModel; use CodeIgniter\Shield\Result; -use InvalidArgumentException; class AccessTokens implements AuthenticatorInterface { diff --git a/src/Authentication/Authenticators/Session.php b/src/Authentication/Authenticators/Session.php index 36b1fc464..5f91f4c3e 100644 --- a/src/Authentication/Authenticators/Session.php +++ b/src/Authentication/Authenticators/Session.php @@ -13,14 +13,13 @@ use CodeIgniter\Shield\Authentication\Passwords; use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\UserIdentity; +use CodeIgniter\Shield\Exceptions\InvalidArgumentException; use CodeIgniter\Shield\Exceptions\LogicException; use CodeIgniter\Shield\Models\LoginModel; use CodeIgniter\Shield\Models\RememberModel; use CodeIgniter\Shield\Models\UserIdentityModel; use CodeIgniter\Shield\Models\UserModel; use CodeIgniter\Shield\Result; -use Exception; -use InvalidArgumentException; use stdClass; class Session implements AuthenticatorInterface @@ -812,8 +811,6 @@ public function recordActiveDate(): void * and stores the necessary info in the db and a cookie. * * @see https://paragonie.com/blog/2015/04/secure-authentication-php-with-long-term-persistence - * - * @throws Exception */ protected function rememberUser(User $user): void { diff --git a/src/Authorization/AuthorizationException.php b/src/Authorization/AuthorizationException.php index b025d10c5..337976a17 100644 --- a/src/Authorization/AuthorizationException.php +++ b/src/Authorization/AuthorizationException.php @@ -2,9 +2,9 @@ namespace CodeIgniter\Shield\Authorization; -use Exception; +use CodeIgniter\Shield\Exceptions\RuntimeException; -class AuthorizationException extends Exception +class AuthorizationException extends RuntimeException { protected $code = 401; diff --git a/src/Authorization/Groups.php b/src/Authorization/Groups.php index b60a62062..9bbe99fdf 100644 --- a/src/Authorization/Groups.php +++ b/src/Authorization/Groups.php @@ -3,7 +3,7 @@ namespace CodeIgniter\Shield\Authorization; use CodeIgniter\Shield\Entities\Group; -use RuntimeException; +use CodeIgniter\Shield\Exceptions\RuntimeException; /** * Provides utility feature for working with diff --git a/src/Exceptions/BaseException.php b/src/Exceptions/BaseException.php new file mode 100644 index 000000000..ddaa8c1a7 --- /dev/null +++ b/src/Exceptions/BaseException.php @@ -0,0 +1,12 @@ +