定制 uniondrug/auth 二次开发

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

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

uniondrug/auth

Composer 安装命令:

composer require uniondrug/auth

包简介

Uniondrug Auth Component

README 文档

README

安装

  1. composer安装
    $ cd project-home
    $ composer require uniondrug/auth
  2. 修改 app.php 配置文件
    return [
        'default' => [
            ......
            'providers'           => [
                ......
                \Uniondrug\Middleware\MiddlewareServiceProvider::class,
                \Uniondrug\Auth\AuthServiceProvider::class,
            ],
        ],
    ];
  3. 设置config/auth.php配置文件, 从vendor/uniondrug/auth/auth.php中复制即可
    <?php
    return [
        'default' => [
            //token存储的redis链接信息
            'redis' => [
                'options' => [
                    'host' => '192.168.3.193',
                    'auth' => "uniondrug@123",
                    'port' => '6379',
                    'timeout' => 10,
                    'index' => 0
                ]
            ],
            //设置签名验证的public key路径(绝对路径!),public key文件从vendor/uniondrug/auth/public.key中复制即可
            //phar包部署时要注意.key文件默认不会被打包,要修改项目的PharCommand.php文件!!!
            'public_key_path' => '',
            //白名单,这个列表内的地址不需要认证,通常放登录接口等地址
            'whitelist' => ''
        ],
        'development' => [
            //token存储的redis链接信息
            'redis' => [
                'options' => [
                    'host' => '',
                    'auth' => '',
                    'port' => '',
                    'timeout' => '',
                    'index' => '' 
                ]
            ],
        ],
        'testing' => [
             //token存储的redis链接信息
            'redis' => [
                'options' => [
                    'host' => '',
                    'auth' => '',
                    'port' => '',
                    'timeout' => '',
                    'index' => ''
                ]
            ],
        ],
        'release' => [
        //token存储的redis链接信息
            'redis' => [
                'options' => [
                    'host' => '',
                    'auth' => '',
                    'port' => '',
                    'timeout' => '',
                    'index' => ''
                ]
            ],
        ],
        'production' => [
            //token存储的redis链接信息
            'redis' => [
                'options' => [
                    'host' => '',
                    'auth' => '',
                    'port' => '',
                    'timeout' => '',
                    'index' => ''
                ]
            ],
        ]
    ];
  4. 设置中间件配置文件 middleware.php
    return [
        'default' => [
            'middlewares' => [
                ...
                // 注册中间件
                'auth' => \Uniondrug\Auth\AuthMiddleware::class,
            ],
    
            'global'      => [
                ...
                // 将中间件放在全局中间列表中
                'auth'
            ],
    
            ...
        ],
    ];

使用

  • 获取通过验证的用户
$_SERVER['member']

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 10
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2020-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固