可在 /config/authsources.php 文件中对身份验证源进行配置。 要配置 LDAP 服务器,请打开 config/authsources.php 文件并以如下格式添加基于 LDAP 的身份验证源:
'example-ldapApacheDS' => array(
'ldap:LDAP',
/* The hostname of the LDAP server. */
'hostname' => 'host:port',
/* Whether TLS should be used when contacting the LDAP server. */
'enable_tls' => TRUE,
/*
* Which attributes should be retrieved from the LDAP server.
* This can be an array of attribute names, or NULL, in which case
* all attributes are fetched.
*/
'attributes' => NULL,
/*
* The pattern that should be used to create the users DN given the username.
* %username% in this pattern will be replaced with the user's username.
*
* This option is not used if the search.enable option is set to TRUE.
*/
'dnpattern' => 'uid=%username%,ou=users,ou=system',
/*
* As an alternative to specifying a pattern for the users DN, it is possible to
* search for the username in a set of attributes. This is enabled by this option.
*/
'search.enable' => FALSE,
/*
* The DN that will be used as a base for the search.
* This can be a single string, in which case only that DN is searched, or an
* array of strings, in which case they will be searched in the order given.
*/
'search.base' => 'ou=users,ou=system',
/*
* The attribute(s) the username should match against.
*
* This is an array with one or more attribute names. Any of the attributes in
* the array may match the value the username.
*/
'search.attributes' => array('uid', 'mail'),
/*
* The username & password the simpleSAMLphp should bind to before searching. If
* this is left as NULL, no bind will be performed before searching.
*/
'search.username' => 'uid=admin,ou=system',
'search.password' => 'password',
),