daynnnnn/statamic-forward-auth
Composer 安装命令:
composer require daynnnnn/statamic-forward-auth
包简介
Allows you to use login using forward authentication.
README 文档
README
Use forward authentication to login to statamic.
How it works
Installation
From a standard Statamic site, you can run:
composer require daynnnnn/statamic-forward-auth
Then publish the config:
php please vendor:publish --tag="statamic-forward-authentication"
Setup
First you'll need to adjust your config/auth.php to use the forward driver on the user provider:
'users' => [
'driver' => 'forward',
],
Then you can edit config/statamic/forward-authentication.php to setup authentication
Types
By default, there's 2 supported services: http and ldap
These can be selected via the default value in config/statamic/forward-authentication.php
LDAP
Description
An ldap search will be made of the base_dn to find the user. If the user is found, try to bind to the found user using provided password.
Config
host: (array) List of LDAP hsots
use_ssl: (bool) Whether host should be accessed with SSL
base_dn: (string) Root search DN to find user in.
username: (string) Bind users DN.
password: (string) Bind users password.
Requirements
The LDAP auth service requires LdapRecord:
composer require directorytree/ldaprecord
HTTP Authentication
Description
A POST request will be sent to the endpoint with the attributes of email and password. The expected response is JSON, and should contain the success status of the credentials, and if the success status is true, the full name of a user.
Config
endpoint: (string) Address on which login will be attempted
result: (array) Where the success status and full name of the user can be found in the JSON response, example:
If your JSON response looks like this:
{
"result": true,
"data": {
"name": "Daniel Pegg"
}
}
Your result array should look like this:
result => [
'success' => 'result',
'name' => 'data.name',
],
Extending
You can also extend this to add your own form of forward authentication, you'll need to create a new class which implements the AuthServiceContract interface, and then set a service in config/statamic/forward-authentication.php. With the service, the only requirment is that the driver is defined as your class, like this:
'driver' => App\AuthServices\MyCustomAuthService::class,
The rest of the config can be setup based on what your custom authentication service needs.
daynnnnn/statamic-forward-auth 适用场景与选型建议
daynnnnn/statamic-forward-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.54k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 07 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 daynnnnn/statamic-forward-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daynnnnn/statamic-forward-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-07-28
