diff --git a/404.html b/404.html index ea15f2f0..dcfb4b4d 100644 --- a/404.html +++ b/404.html @@ -5,7 +5,7 @@
The isGranted
method simply retrieves the client IP address, and checks it against the blacklist.
However, for this to work, we must register the newly created guard with the guard plugin manager. To do so, add the following code in your config:
-return [
'zfc_rbac' => [
'guard_manager' => [
'factories' => [
'Application\Guard\IpGuard' => 'Application\Factory\IpGuardFactory'
]
]
]
];
return [
'lmc_rbac' => [
'guard_manager' => [
'factories' => [
'Application\Guard\IpGuard' => 'Application\Factory\IpGuardFactory'
]
]
]
];
The guard_manager
config follows a conventional service manager configuration format.
Now, let's create the factory:
namespace Application\Factory;
use Application\Guard\IpGuard;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
class IpGuardFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
if (null === $options) {
$options = [];
}
return new IpGuard($options);
}
}