raditzfarhan/laravel-user-security
Composer 安装命令:
composer require raditzfarhan/laravel-user-security
包简介
Add security pin, mnemonic key and 2fa authentication feature to users.
README 文档
README
Laravel User Security - RFAuthenticator
Add security pin, mnemonic key and 2fa authentication feature to users.
Installation
Via Composer
$ composer require raditzfarhan/laravel-user-security:^1.0
Configuration
The Laravel and Lumen configurations vary slightly, so here are the instructions for each of the frameworks.
Laravel
Edit the config/app.php file and add the following line to register the service provider:
'providers' => [ ... RaditzFarhan\UserSecurity\UserSecurityServiceProvider::class, ... ],
Tip: If you're on Laravel version 5.5 or higher, you can skip this part of the setup in favour of the Auto-Discovery feature.
Lumen
Edit the bootstrap/app.php file and add the following line to register the service provider:
... $app->register(RaditzFarhan\UserSecurity\UserSecurityServiceProvider::class); ...
You will also need to enable Facades in bootstrap/app.php:
.. $app->withFacades(true, [ ... RaditzFarhan\UserSecurity\Facades\RFAuthenticator::class => 'RFAuthenticator' ]); ...
Open your user provider model class, for example App\User, and add RaditzFarhan\UserSecurity\Traits\UserSecurable trait:
<?php namespace App; ... use RaditzFarhan\UserSecurity\Traits\UserSecurable; class User extends Model implements AuthenticatableContract, AuthorizableContract { ... use UserSecurable; ... }
Usage
Example usage as below snippet:
// to add/update security pin for eloquent user $user->updateSecurityPin($security_pin); // to add/update entropy for eloquent user $user->updateEntropy($entropy); // to add/update multiple authenticators $user->updateMultipleAuthenticators(['security_pin' => $security_pin, 'mnemonic_entropy' => $entropy]);
To use mnemonic functions, examples as below:
// Success response // using service container to generate mnemonic object $mnemonic = app('RFAuthenticator')->mnemonic()->generate(); // using alias to generate mnemonic object $mnemonic = \RFAuthenticator::mnemonic()->generate(); // Use mnemonic codes to find entropy $mnemonic = \RFAuthenticator::mnemonic()->words($words); // Generate Mnemonic using specified Entropy $mnemonic = \RFAuthenticator::mnemonic()->entropy($entropy);
Change log
Please see the changelog for more information on what has changed recently.
Credits
License
MIT. Please see the license file for more information.
raditzfarhan/laravel-user-security 适用场景与选型建议
raditzfarhan/laravel-user-security 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 708 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 04 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「user」 「laravel」 「pin」 「2fa」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 raditzfarhan/laravel-user-security 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 raditzfarhan/laravel-user-security 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 raditzfarhan/laravel-user-security 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provide a way to secure accesses to all routes of an symfony application.
It's a barebone security class written on PHP
Contao CMS integrity check for some files
Standalone replacement for php's native get_browser() function
A PHP security linter to detect insecure functions like var_dump, print_r, and other dangerous functions in your codebase
User component for Yii2
统计信息
- 总下载量: 708
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-18