定制 rehankanak/guardian 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rehankanak/guardian

Composer 安装命令:

composer require rehankanak/guardian

包简介

Laravel package for verifying desktop sign-in via a mobile app

README 文档

README

Latest Version on Packagist Total Downloads

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

  1. 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/generate route to generate a Guardian, with the users uuid
    • Once, the guardian is generated, trigger a notification to the user with the GuardianType and the GuardianOption obtained in the previous step.
  2. Poll the POST /api/guardian/status route 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
  3. 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/respond route 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 rehankanak/guardian 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-15