pvsv1984 / lumen-2fa
A One Time Password Authentication package, compatible with Google Authenticator. Authenticates oauth tokens
Requires
- php: >=7.0
- pragmarx/google2fa-laravel: ^2.0.1
- prodevel/laravel-classes: ^0.6
Requires (Dev)
- orchestra/testbench-browser-kit: ~3.4|~3.5|~3.6
- phpunit/phpunit: ~5|~6|~7
Suggests
- bacon/bacon-qr-code: Required to generate inline QR Codes.
- pragmarx/google2FA: For use with full Laravel packages.
- pragmarx/recovery: Generate recovery codes.
This package is auto-updated.
Last update: 2024-11-10 15:28:40 UTC
README
Google Two-Factor Authentication Package for Lumen
Package install: composer require pvsv1984/lumen-2fa
Google2FA is a PHP implementation of the Google Two-Factor Authentication Module, supporting the HMAC-Based One-time Password (HOTP) algorithm specified in RFC 4226 and the Time-based One-time Password (TOTP) algorithm specified in RFC 6238.
This package is a Lumen update to to Google2FA for Laravel package.
The intent of this package is to create a microservice safe way to implement 2FA Code and check responses against user.
Recovery/Backup codes
if you need to create recovery or backup codes to provide a way for your users to recover a lost account, you can use the Recovery Package.
Installation on Lumen
Add the Service Provider to your bootstrap/app.php
Lshtmweb\Lumen2FA\TwoFactorServiceProvider::class
This package assumes you are using Dusterio passport for api authentication and have the standard oauth_tables. Feel free to change the migrations to suit your needs.
Publish the config file and migrations
php artisan vendor:publish --provider="Lshtmweb\Lumen2FA\TwoFactorServiceProvider::class"
Usage
The standard routes have already been set up for you. You can change to suit your need by adding routes and pointing to the correct Controller methods.
- Add the middleware
- In route middleware add a new middleware or use the default one
lumen2fa
to secure your routes.
- In route middleware add a new middleware or use the default one
Events Fired
- TwoFactorActivatedEvent
- TwoFactorBeforeDisableEvent
- TwoFactorDisabledEvent
- TwoFactorInfoGeneratedEvent
Using Laravel? Try this instead
Changes
Pull requests are welcome