rehankanak/guardian
Composer 安装命令:
composer require rehankanak/guardian
包简介
Laravel package for verifying desktop sign-in via a mobile app
README 文档
README
This Laravel package helps your application to verify a user's sign-in on a desktop browser via a mobile app. It works by generating a set of options, to which the user responds via the mobile app. If the user responds correctly, then the sign-in is verified and can be authorized.
We have the following GuardingType in our package
- INPUT: The user inputs a code, into the mobile app.
- PRESS: The users presses a code, into the mobile app.
- APPROVE/DENY: The user approves or denies the sign-in request, via the mobile app.
The package provides the following routes:
POST /api/guardian/generate- This route is used to generate a Guardian for the user to respond to.
POST /api/guardian/respond- This route is used to respond to the Guardian via the Mobile app.
POST /api/guardian/status- This route is used to verify the user's response and authorize the sign-in.
The Flow:
Desktop
- When the user tries to sign-in on the desktop, and when the user credentials are verified, generate a Guardian for the user to respond to.
- Use the
POST /api/guardian/generateroute to generate a Guardian, with the usersuuid - Once, the guardian is generated, trigger a notification to the user with the GuardianType and the GuardianOption obtained in the previous step.
- Use the
- Poll the
POST /api/guardian/statusroute to check if the user has responded to the Guardian, this can give you three types of results- -1: The user has not responded yet
- 0: The user has responded, with incorrect response
- 1: The user has responded, with the correct response
- Based on the Status, you can either authorize the sign-in or ask the user to respond again or generate a fresh guardian.
Mobile
- Show a UI to the user, based on the GuardianType and GuardianOption
- INPUT: Show a text input to the user, to input the code
- PRESS: Show a list of codes to the user, to press the right code
- APPROVE/DENY: Show two buttons to the user, to approve or deny the sign-in request
- When the user responds, use the
POST /api/guardian/respondroute to send the response to the server.
Installation
You can install the package via composer:
composer require rehankanak/guardian
Contributing
This is a community driven package. If you find any errors, please create a pull request with the fix, or at least open an issue.
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
rehankanak/guardian 适用场景与选型建议
rehankanak/guardian 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「Authentication」 「laravel」 「2fa」 「two-factor-authentication」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rehankanak/guardian 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rehankanak/guardian 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rehankanak/guardian 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
Provide a way to secure accesses to all routes of an symfony application.
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
It's a barebone security class written on PHP
Email Toolkit Plugin for CakePHP
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-15