liberty_code / authentication_model
Library
Requires
- php: ~7 || ~8
- liberty_code/authentication: ^1.0.
- liberty_code/library: ^1.0.
- liberty_code/model: ^1.0.
- liberty_code/validation: ^1.0.
This package is auto-updated.
Last update: 2024-10-27 22:54:16 UTC
README
Description
Library contains authentication model components, to manage identification and authentication system.
Requirement
- Script language: PHP: version 7 || 8
Framework library implementation requirement
Library repository: liberty_code/validation: version 1.0
Standard rules implementation (or equivalent):
Validator provided on entities, must contain all standard rules, added on its rule collection.
Validator rules implementation (or equivalent):
Validator provided on entities, must contain all validator rules, added on its rule collection. Each validator rule must use validator, with same implementation as validator provided on entities.
Installation
Several ways are possible:
Composer
Requirement
It requires composer installation. For more information: https://getcomposer.org
Command: Move in project root path
cd "<project_root_path>"
Command: Installation
php composer.phar require liberty_code/authentication_model ["<version>"]
Note
Include vendor
If project uses composer, vendor must be included:
require_once('<project_root_path>/vendor/autoload.php');
Configuration
Installation command allows to add, on composer file "
{ "require": { "liberty_code/authentication_model": "<version>" } }
Include
Download
- Download following repository.
- Put it on repository root path.
Include source
require_once('<repository_root_path>/include/Include.php');
Usage
Authentication
Authentication entity allows to design an authentication class, using entity.
Elements
AuthenticationEntity
Extends authentication features. Uses entity to design an authentication class, to get all identification and authentication information, about one specific entity.
SecretAuthEntity
Extends authentication entity features. Uses identifier attribute, as identification information and secret attribute, as authentication information.
TokenAuthEntity
Extends authentication entity features. Uses token attribute, as identification and authentication information.
CredentialAuthEntity
Extends authentication entity features. Uses credential attribute to retrieve identifier, as identification and secret, as authentication information.
Example
// Get secret authentication entity
use liberty_code\authentication_model\authentication\secret\library\ConstSecretAuth;
use liberty_code\authentication_model\authentication\secret\model\SecretAuthEntity;
$secretAuthEntity = new SecretAuthEntity();
...
// Set identifier attribute
$secretAuthEntity->setAttributeValue(ConstSecretAuth::ATTRIBUTE_KEY_IDENTIFIER, '...');
...
// Set secret attribute
$secretAuthEntity->setAttributeValue(ConstSecretAuth::ATTRIBUTE_KEY_SECRET, '...');
...
// Get array of identification data
var_dump($secretAuthEntity->getTabIdData());
...
// Get array of authentication data
var_dump($secretAuthEntity->getTabAuthData());
...