PHP code example of iserranodev / certificate-auth-bundle
1. Go to this page and download the library: Download iserranodev/certificate-auth-bundle 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/ */
iserranodev / certificate-auth-bundle example snippets
namespace App\Security;
use CertificateAuthBundle\Transformer\IdentifierTransformerInterface;
class Sha256Transformer implements IdentifierTransformerInterface
{
public function transform(string $identifier): string
{
return hash('sha256', $identifier);
}
}
namespace App\Security;
use CertificateAuthBundle\Transformer\IdentifierTransformerInterface;
use ISerranoDev\EncryptBundle\Service\EncryptService;
class EncryptTransformer implements IdentifierTransformerInterface
{
public function __construct(
private readonly EncryptService $encryptService
) {}
public function transform(string $identifier): string
{
return $this->encryptService->hashData($identifier);
}
}
namespace App\Security;
use CertificateAuthBundle\Security\CertificateChecker as BaseChecker;
use Symfony\Component\Security\Core\User\UserInterface;
class CustomCertificateChecker extends BaseChecker
{
public function checkPreAuth(UserInterface $user): void
{
parent::checkPreAuth($user);
// Tu lógica adicional...
}
}
namespace App\Security;
use CertificateAuthBundle\Security\CertificateDataExtractor as BaseExtractor;
use Symfony\Component\HttpFoundation\Request;
class CustomDataExtractor extends BaseExtractor
{
public function extract(Request $request): ?string
{
// Tu lógica personalizada
}
}