PHP code example of nattreid / security
1. Go to this page and download the library: Download nattreid/security library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nattreid / security example snippets
class FrontAuthenticator implements \NAttreid\Security\Authenticator\IAuthenticator {
public function authenticate(array $credentials): Identity {
// php code
}
public function getIdentity(int $userId): Identity {
// php code
}
}
/** @inject */
public $tryUserFactory;
protected function startup()
{
parent::startup();
$this['tryUser']->init();
}
protected function createComponentTryUser()
{
$control = $this->tryUserFactory->create(":Link:Nekam:");
$control->permission = 'nazev.prav.pro.komponentu';
return $control;
}