fourcms/auth

fourcms 的认证包

1.0.2 2017-06-29 15:45 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:18:30 UTC


README

主分支: build status

目录

安装

通过 Composer 安装此包。

编辑项目中的 composer.json 文件,添加自定义仓库并需要 platfourm/auth

创建 composer.json 文件

{
    "name": "yourproject/yourproject",
    "type": "project",
    "require": {
        "platfourm/auth": "dev_master"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.itdc.ge"
        }
    ]
}

并运行 composer update

更新 composer 后,将 AuthServiceProvider 添加到 config/app.php 中的 providers 数组

Platfourm\Auth\AuthServiceProvider::class,

并将 Platfourm\Auth\RemoteUserTrait 添加到您的用户模型中。

在 config/auth.php 中添加新的 guard 到 guards 部分

'itdc' => [
    'driver'   => 'session',
    'provider' => 'itdc',
],

并在 providers 部分添加 provider

'itdc' => [
    'driver'      => 'itdc', // Driver name
    'model'       => App\User::class, // User model class
    'endpoint'    => 'https://service.itdc.ge/api7', // Authorization service endpoint
    'check_ip'    => true, // Check allowed or not authorization on service from user's ip
    'auto_save'   => true, // Save remote user in local database on success login. On false will be used cache storage
    'attach_role' => '', // If you are using Entrust Permissions package, provide default role for remote user
],

之后,您可以将 config/auth.php 中的默认 guard 更改为 itdc

'defaults' => [
    'guard'     => 'itdc',
    'passwords' => 'users',
],

使用方法

您必须将应用程序 APP_KEY 添加到 ITDC Auth 服务器进行身份验证

待办事项

编写测试

故障排除

请在 问题 页面上报告您发现的任何错误。

贡献

欢迎 pull requests。有关信息,请参阅 CONTRIBUTING.md

许可协议

请参阅此存储库中包含的 LICENSE,以获取完整版权许可的副本,该项目据此许可。

鸣谢