定制 rehankanak/guardian 二次开发

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

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

rehankanak/guardian

最新稳定版本:1.1.0

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.

统计信息

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

GitHub 信息

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

其他信息

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