ldap身份验证代码中的致命错误

时间:2013-12-12 09:31:55

标签: php ldap

我将避免在所有PHP项目中使用Login Form。而不是登录表单我将使用LDAP Active Directory选项。自动用户可以通过Active Directory登录。我们在所有系统中安装了Active Directory。因此,所有系统都只在Active Directory下。

我的PHP项目使用WAMP服务器。我在WAMP上启用了LDAP。我有这个登录的代码。如果我运行该程序意味着我得到一个错误,如

  

解析错误:语法错误,第3行的D:\ wamp \ www \ ldap_connect \ LdapAuth.inc.php中的意外“私有”(T_PRIVATE)。

下面是LDAP身份验证的代码:

/* Configuration section: */
    private $serviceUser="cn=Administrator,ou=Plants,dc=vrv,dc=it";
    private $serviceSecret="serviceUSERpassword";
    /* Tip: a service user is required (keeping enabled anonymous access is a bad thing)
     * and you are supposed do write some ACL to limit the service user to read-only the cn 
     * and the uid attribute in the People tree 
     */
    private $BaseDn="ou=People,dc=mydomain,dc=com"; //where are the users in the tree?
    private $UIDAttributeName="uid"; // what attribute you wanna search for the search & bind login? 

//例。 “mail”允许用户使用他们的电子邮件地址和密码登录

    private $ServerList = Array(
        /* Multiple LDAP Servers: for load balancing/ HA redundancy mode, not for multi-ldap auth!!!!
         *  (Server MUST have some user tree synchronization mechanism e.g. OpenLDAP syncrepl ) */
        Array(
                                    "ip"=>"123.123.123.123",
                                    "name"=>"ldap-master",
                                    "sslport"=>636,
                                    "port"=>389
        ),
        Array(
                                    "ip"=>"ldap125.mydomain.com",
                                    "name"=>"ldap-replica",
                                    "sslport"=>636,
                                    "port"=>389
        )
        /* You can add or remove LDAP server entries (But this is not multi-ldap:
         *  servers MUST have the same user tree */
    );

    private $accessLogFile="ldap.access.log"; //file where access will be logged

    /* Optional parametes (keep it to empty or wrong string if you don't want AuhtZ attributes: */

     /*
      * Note: all attribute names MUST be written in lowercase e.g. givenName -> givenname
      */

    /* Optional*/ private $AuthorizativeAttrName="member";  //can be multi-value
    /* Optional*/ private $AuthorizativeJSONAttrName="x-garr-authoritativejsondata";  //single valued JSON String attribute  e.g. {"myappLevel":"admin","yourappLevel":"guest"}

    /*
     * Other configuration options can be set programmatically, check
     * for the setters methods of this class and call it before
     * calling the method authenticate() into a page to protect.
     */

0 个答案:

没有答案