ride/lib-security-generic

Generic security model of the Ride framework

1.0.0 2016-10-11 09:01 UTC

This package is auto-updated.

Last update: 2024-04-12 23:22:51 UTC


README

Generic security model for the security library of the PHP Ride framework.

This security model is file based and usefull for a small user base or as a backup for other security models.

What's In This Library

SecurityModelIO

The SecurityModelIO interface is used by the GenericSecurityModel as a data source.

An implementation is provided for the XML format by the XmlSecurityModelIO class.

GenericSecurityModel

The GenericSecurityModel class offers a generic implementation of the SecurityModel interface from the ride/lib-security module. This class also implements the GenericUser, GenericRole and GenericPermission classes.

Code Sample

Check this code sample to see how to initialize this library:

use ride\library\encryption\hash\Hash;
use ride\library\event\EventManager;
use ride\library\security\model\generic\io\XmlSecurityModelIO;
use ride\library\security\model\generic\GenericSecurityModel;
use ride\library\system\System;

function createSGenericSecurityModel(System $system, EventManager $eventManager, Hash $hashAlgorithm) {
    $file = $system->getFileSystem()->getFile('/path/to/security.xml');
    $securityModelIO = new XmlSecurityModelIO($file);
    
    $securityModel = new GenericSecurityModel($securityModelIO, $eventManager, $hashAlgorithm);
    
    return $securityModel;
}

Implementations

You can check the related implementations of this library:

Installation

You can use Composer to install this library.

composer require ride/lib-security-generic