portal89/cakephp-ad-auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

portal89/cakephp-ad-auth

Composer 安装命令:

composer require portal89/cakephp-ad-auth

包简介

CakePHP plugin for Active Directory authentication over LDAP.

README 文档

README

Extends CakePHP's built-in authentication types to offer form authentication for Active Directory users over LDAP using Adldap2.

Installing With Composer

Install Active Directory Authentication by CLI:

composer require Portal89/cakephp-ad-auth

Install Active Directory Authentication by adding the following to your composer.json file:

"require": {
    "Portal89/cakephp-ad-auth"
}

Run composer's update command to download the plugin.

Loading Into A CakePHP Application

After installing with Composer, load the plugin manual:

// add to src\Application.php
Plugin::load('ActiveDirectoryAuthenticate');

After installing with Composer, load the plugin CLI:

bin/cake plugin load ActiveDirectoryAuthenticate

Adding Active Directory Authentication

Authentication is handled similarly to Cake's native FormAuthenticate. This includes FormAuthenticate's core configuration options as well as some expanded options for Active Directory connectivity and queried data.

To add the Active Directory authentication component to your application open your src/Controller/AppController.php file and add the following lines in the initialize() function. Extended options are further described below. For more information on CakePHP's core FormAuthenticate and associated options see the Cookbook's authentication example.

public function initialize()
{
    //...

    $this->loadComponent('Auth', [
        'authenticate' => [
            'ActiveDirectoryAuthenticate.Adldap' => [
                'config' => [
                    'account_suffix' => '@corp.acme.org',
                    'base_dn' => 'dc=corp,dc=acme,dc=org',
                    'domain_controllers' => ['ACME-DC01.corp.acme.org']
                ]
            ]
        ]
    ]);

    //...
}

Configuration Options

'config'

The config key must contain an array which describes your environment so that a connection can be made. In many cases this only needs to include the account suffix, domain controllers and base dn.

'config' => [
    'account_suffix' => '@corp.acme.org',
    'base_dn' => 'dc=corp,dc=acme,dc=org',
    'domain_controllers' => ['ACME-DC01.corp.acme.org']
]

Expanded options include support for ssl, tls and non-standard ports. See the full list of available options on Adldap2's configuration docs.

'select'

The select key can either be an array of attributes to return or null (defaults to null). These attributes will depend on the LDAP attributes available from your Active Directory environment.

If set to null then all available information will be returned for the user.

'select' => [
    'displayName',
    'samaccountname',
    'telephonenumber',
    'mail'
]

Microsoft's Active Directory Schema Documentation is a good resource for referencing available LDAP attributes, but these may vary depending on your Active Directory environment.

'ignored'

The ignored key is an array of keys for which you do not want data returned. By default the ignored array contains 'distinguishedname', 'dn', 'objectcategory' and 'objectclass' in order to clean up the data that is returned to the Auth component. Set ignored to null or a blank array if you would like to retrieve all keys.

'ignored' => [
    'distinguishedname',
    'dn',
    'objectcategory',
    'objectclass'
]

Group Membership Handling

The authenticated user's groups are always retrieved and returned in the memberof and groups keys.

memberof contains an array of the user's Active Directory groups in their original format.

'memberof' => [
    0 => 'CN=Admins,OU=Applications,OU=Groups,DC=acme,DC=org',
    1 => 'CN=WordPress Editors,OU=Applications,OU=Groups,DC=acme,DC=org',
    2 => 'CN=Google Apps Users,OU=Applications,OU=Groups,DC=acme,DC=org',
    3 => 'CN=Members,OU=Security,OU=Groups,DC=acme,DC=org'
]

groups contains an array of the user's Active Directory groups by name only. You may find this useful when defining granular access to controllers and actions.

'groups' => [
    0 => 'Admins',
    1 => 'WordPress Editors',
    2 => 'Google Apps Users',
    3 => 'Members'
]

Testing

Tests are not yet written for this plugin. Once they are available, version 1.0 will be tagged and released.

portal89/cakephp-ad-auth 适用场景与选型建议

portal89/cakephp-ad-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 07 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cakephp」 「ldap」 「ad」 「authenticate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 portal89/cakephp-ad-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 portal89/cakephp-ad-auth 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-28