1. Go to this page and download the library: Download sinema/gate-guardian 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/ */
php
namespace My\Package;
use CloakPort\GuardContract;
use CloakPort\GuardTypeContract;
use CloakPort\TokenGuard as DefaultGuard;
use My\Package\TokenGuard as MyGuard;
enum GuardType implements GuardTypeContract
{
case ZITADEL;
case MY_GUARD;
case DEFAULT;
public static function load(string $backend): self
{
return match(strtolower($backend)) {
'my_guard' => GuardType::MY_GUARD,
// ...
default => GuardType::DEFAULT
};
}
public function loadFrom(array $config): GuardContract
{
return match ($this) {
self::MY_GUARD => MyGuard::load($config),
// ...
self::DEFAULT => DefaultGuard::load($config)
};
}
}
php
namespace My\Package;
use CloakPort\GuardContract;
use CloakPort\TokenGuard as ParentTokenGuard;
use Illuminate\Contracts\Auth\Guard;
class TokenGuard extends ParentTokenGuard implements Guard, GuardContract
{
public static function load(array $config): self
{
return new self();
}
public function validate(array $credentials = [])
{
// any magic to valid your JWT
return $this->check();
}
public function check()
{
return false;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.