-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement symlink, crazyAuth and update Extension
- Loading branch information
1 parent
fb9f7e0
commit 8438630
Showing
9 changed files
with
725 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
resources/Extensions/CrazyAuth/Scripts/Interface/AuthInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Crazy Auth Interface | ||
* | ||
* PHP version 8.1.2 | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
namespace App\Core; | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
use CrazyPHP\Library\Exception\ExceptionResponse; | ||
use App\Core\CredentialInterface; | ||
use App\Core\UserInterface; | ||
|
||
/** | ||
* Auth Interface | ||
* | ||
* Interface for authentification | ||
* | ||
* @source https://github.com/PHPAuth/PHPAuth/blob/master/sources/AuthInterface.php | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
interface AuthInterface { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param CredentialInterface $credentials | ||
* @param ?UserInterface $user (Null means you are registering a new user) | ||
* @param array $options | ||
* @param self | ||
*/ | ||
public function __construct(CredentialInterface $credentials, ?UserInterface $user = null, array $options = []); | ||
|
||
/** Public method | Action | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Register | ||
* | ||
* Register new user | ||
* | ||
* @return self | ||
*/ | ||
public function register():self; | ||
|
||
/** | ||
* Login | ||
* | ||
* Login existing user | ||
* | ||
* @return self | ||
*/ | ||
public function login():self; | ||
|
||
/** | ||
* Logout | ||
* | ||
* Logout existing user | ||
* | ||
* @return self | ||
*/ | ||
public function logout():self; | ||
|
||
/** | ||
* Logout | ||
* | ||
* Logout all user | ||
* | ||
* @return self | ||
*/ | ||
public function logoutAll():self; | ||
|
||
/** | ||
* Activate | ||
* | ||
* Activate existing user | ||
* | ||
* @return self | ||
*/ | ||
public function activate():self; | ||
|
||
/** | ||
* Delete | ||
* | ||
* Delete existing user | ||
* | ||
* @return self | ||
*/ | ||
public function delete():self; | ||
|
||
/** | ||
* Change Email | ||
* | ||
* Change email of existing user | ||
* | ||
* @return self | ||
*/ | ||
public function changeEmail(); | ||
|
||
/** | ||
* Change Password | ||
* | ||
* Change password of existing user | ||
* | ||
* @return self | ||
*/ | ||
public function changePassword(); | ||
|
||
|
||
/** Public method | Validator | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Is User Connected | ||
* | ||
* Check if user is connected | ||
* | ||
* @return bool | ||
*/ | ||
public function isUserConnected():bool; | ||
|
||
/** | ||
* Is User Valid | ||
* | ||
* Check if user is valid | ||
* | ||
* @return bool | ||
*/ | ||
public function isUserValid():bool; | ||
|
||
/** | ||
* Is User Locked | ||
* | ||
* Check if user is locked | ||
* | ||
* @return bool | ||
*/ | ||
public function isUserLocked():bool; | ||
|
||
/** Public method | Get | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Get UID | ||
* | ||
* Get unique ID of the auth | ||
*/ | ||
public function getUID():int; | ||
|
||
/** | ||
* Get user | ||
* | ||
* @return ?UserInterface | ||
*/ | ||
public function getUser():?UserInterface; | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
resources/Extensions/CrazyAuth/Scripts/Interface/CredentialInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Crazy Auth Interface | ||
* | ||
* PHP version 8.1.2 | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
namespace App\Core; | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
use CrazyPHP\Library\Exception\ExceptionResponse; | ||
use App\Core\UserInterface; | ||
|
||
/** | ||
* Credential Interface | ||
* | ||
* Interface for credential | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
interface CredentialInterface { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param array $form | ||
* @param array $options | ||
* @param self | ||
*/ | ||
public function __construct(array $form, array $options = []); | ||
|
||
/** Public method | Validator | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Is Email Taken | ||
* | ||
* Check if email is already given | ||
* | ||
* @return bool | ||
*/ | ||
public function isEmailTaken():bool; | ||
|
||
} |
114 changes: 114 additions & 0 deletions
114
resources/Extensions/CrazyAuth/Scripts/Interface/UserInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Crazy Auth Interface | ||
* | ||
* PHP version 8.1.2 | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
namespace App\Core; | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
use CrazyPHP\Library\Exception\ExceptionResponse; | ||
|
||
/** | ||
* User Interface | ||
* | ||
* Interface for users | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
interface UserInterface { | ||
|
||
/** Public method | Get | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Get User Identifier | ||
* | ||
* The public representation of the user (e.g. a username, an email address, etc.) | ||
* | ||
* @return string | ||
*/ | ||
public function getUserIdentifier():string; | ||
|
||
/** | ||
* Get Id | ||
* | ||
* @return ?int | ||
*/ | ||
public function getId():?int; | ||
|
||
/** | ||
* Get Email | ||
* | ||
* @return ?string | ||
*/ | ||
public function getEmail():?string; | ||
|
||
/** | ||
* Get Roles | ||
* | ||
* Returns the roles granted to the user. | ||
* | ||
* @return array | ||
*/ | ||
public function getRoles():array; | ||
|
||
/** | ||
* Get Password | ||
* | ||
* @return string | ||
*/ | ||
public function getPassword():string; | ||
|
||
/** | ||
* Set Lock | ||
* | ||
* @return string | ||
*/ | ||
public function setLock():string; | ||
|
||
/** Public method | Set | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Set Email | ||
* | ||
* @param string $email | ||
* @return self | ||
*/ | ||
public function setEmail(string $email):self; | ||
|
||
/** | ||
* Set Password | ||
* | ||
* @param string $password | ||
* @return self | ||
*/ | ||
public function setPassword(string $password):self; | ||
|
||
/** | ||
* Set Roles | ||
* | ||
* @param array $roles | ||
* @return self | ||
*/ | ||
public function setRoles(array $roles):self; | ||
|
||
/** | ||
* Get Lock | ||
* | ||
* @return string | ||
*/ | ||
public function getLock():string; | ||
|
||
} |
Oops, something went wrong.