1. Go to this page and download the library: Download restricted/authchain 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/ */
restricted / authchain example snippets
'providers' => [
// Your Laravel providers here...
'Restricted\Authchain\AuthchainServiceProvider'
]
namespace Restricted\Authchain\Provider\Domain;
use Restricted\Authchain\Config\Loader;
use Restricted\Authchain\Provider\Provider;
use Restricted\Authchain\Provider\ProviderInterface;
class CustomProviderExample extends Provider implements ProviderInterface
{
// Authentication logic
// $this->username is username provided by user
// $this->password is password from form
// @return UserInterface|null
public function authenticate()
{
// Loading users from config for domain $this->domain
$users = Loader::domain($this->domain)['users'];
// If user not found in array, return null
if (!isset($users[$this->username])) {
return null;
}
// Grab user password from config
$password = $users[$this->username];
// Check password
if (\Hash::check($this->password, $password)) {
$newUser = $this->model();
$newUser->{Loader::username()} = $this->username;
$newUser->{Loader::password()} = \Hash::make($password);
$newUser->enabled = true;
$newUser->save();
return $newUser;
}
return null;
}
// Must return name of the provider, for example 'custom'
// In app/config/packages/restricted/authchain/config.php
// you can regiter new provider in 'providers' array and pass config variables to it
public function provides()
{
return 'custom';
}
}
return array(
'driver': 'authchain'
// Related stuff...
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.