定制 erwin32/ldap 二次开发

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

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

erwin32/ldap

Composer 安装命令:

composer require erwin32/ldap

包简介

Simple lib to authenticate trough ldap with some extra features

README 文档

README

class for very simple ldap auth cheks if user exists and if he/she is in given group.

Usage:

$ composer require erwin32/ldap

Init sample

    // Active Directory server
    $ldap_host = "123.123.123.123";//IP adress or url

    // Active Directory DN
    $ldap_dn = 'DC=domain,DC=com';//domain in this example is used "domain.com"

    // Active Directory user group
    $ldap_user_group = "Group Name";

    // Active Directory manager group
    $ldap_manager_group = "Admins";

    // Domain, for purposes of constructing $user
    $ldap_usr_dom = "@domain.com";

    //class inicialization
    $ldap=new \LDAP\auth($ldap_host, $ldap_dn, $ldap_user_group, $ldap_manager_group, $ldap_usr_dom);

For auth use like this(expects inicialized class in $ldap)

first argument is username second is passoword

    try {
        $ldap->authenticate($user, $pass);
    } catch (Exception $exc) {
        $msg=$exc->getMessage();
        $code=$exc->getCode();

        //this is how we can determine if user dont have corect group but exist on LDAP
        if($ldap::ERROR_WRONG_USER_GROUP==$code){
            //custom handling
        }
    }

Thumbnail img retrival example

    try {
        $ldap->userInit($user, $pass);
        //we can display it like this
        echo '<img src="'.$ldap->getLDAPimg().'">';

    } catch (Exception $exc) {
        $msg=$exc->getMessage();
        $code=$exc->getCode();

        //react to problems
    }

Exeptions Error codes

    $ldap::ERROR_WRONG_USER_GROUP

    $ldap::ERROR_CANT_AUTH

    $ldap::ERROR_CANT_SEARCH

    $ldap::ERROR_IMG_DECODE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2013-11-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固