surfnet / yubikey-api-client-bundle
A Symfony bundle to integrate Yubikey OTP validation service.
Installs: 12 259
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 12
Forks: 2
Open Issues: 0
Requires
- php: ^8.2
- surfnet/yubikey-api-client: ^2.3
- symfony/config: ^5.0|^6.0
- symfony/console: ^6.4
- symfony/dependency-injection: ^5.0|^6.0
- symfony/http-kernel: ^5.0|^6.0
- symfony/yaml: ^6.4
Requires (Dev)
- matthiasnoback/symfony-config-test: ^5.0
- mockery/mockery: ^1.6
- overtrue/phplint: ^9.0
- phpmd/phpmd: ^2.0
- phpstan/phpstan: ^1.10
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-mockery: ^1.1
- phpstan/phpstan-symfony: ^1.3
- phpunit/phpunit: ^9.0
- sebastian/phpcpd: ^6.0
- slevomat/coding-standard: ^8.15
- squizlabs/php_codesniffer: ^3
- symfony/framework-bundle: ^v5.4.36
- symfony/monolog-bundle: ^3.0
This package is auto-updated.
Last update: 2024-10-25 07:49:29 UTC
README
A Symfony bundle to integrate Yubikey's OTP validation service.
Installation
Add the bundle to your Composer file.
composer require 'surfnet/yubikey-api-client-bundle'
Add the bundle to your AppKernel.
public function registerBundles() { $bundles[] = new Surfnet\YubikeyApiClientBundle\SurfnetYubikeyApiClientBundle; }
Usage
public function fooAction() { /** @var \Surfnet\YubikeyApiClientBundle\Service\VerificationService */ $service = $this->get('surfnet_yubikey_api_client.verification_service'); if (!\Surfnet\YubikeyApiClient\Otp::isValid('user-input-otp-here')) { // User-entered OTP string is not valid. } $otp = \Surfnet\YubikeyApiClient\Otp::fromString('user-input-otp-here'); $result = $service->verify($otp); if ($result->isSuccessful()) { // Yubico verified OTP. } }