定制 daynnnnn/statamic-forward-auth 二次开发

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

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

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

Screenshot 2021-07-31 at 16 15 20

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 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-07-28