Skip to content
Snippets Groups Projects
Commit a3e648d2 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docs

parent 7af1139d
No related branches found
No related tags found
Loading
......@@ -10,24 +10,18 @@ require_once '[APPROOT]/classes/ldap.class.php';
As an example I create a hash named $aConfig and save it as "inc_config.php".
```php
return [
...
'ldap-master' => [
'server' => 'ldaps://ldap.example.com',
'DnLdapUser' => 'cn=Lookup,ou=Service,dc=some,dc=example.com',
'PwLdapUser' => 'PasswordOfLookupUser',
// node where to find users that are allowed to login
'DnUserNode' => 'ou=People,dc=some,dc=example.com',
// node where to find my app
'DnAppNode' => 'cn=MyApp,dc=some,dc=example.com',
'debugLevel' => 0,
],
...
...
'ldap-master' => [
'server' => 'ldaps://ldap.example.com',
'DnLdapUser' => 'cn=Lookup,ou=Service,dc=some,dc=example.com',
'PwLdapUser' => 'PasswordOfLookupUser',
// See Configuration page for all values.
],
...
];
```
......
......@@ -83,7 +83,7 @@ set a ldap config
'server' => 'ldaps://ldap.example.com',
'port' => 636,
'DnLdapUser' => 'cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com', // ldap rdn oder dn
'PwLdapUser' => 'IkHEFFzlZ...99j0h8WdI0LrLhxU', // password
'PwLdapUser' => 'PasswordOfLookupUser', // password
'DnUserNode' => 'ou=People,ou=ORG,dc=org,dc=example.com',
'DnAppNode' => '' optional dn ... if a user must be member of a given group
'protoVersion' => 3
......
......@@ -2,11 +2,43 @@
When initializing a new imlldap object or use setConfig then you can apply these values:
Var | Type | Desciption | Example
-- |-- |-- |--
'server' | string | Server connection with "ldap(s)://host[:port]" | 'ldaps://ldap.example.com'
'DnLdapUser' | string | Bind user as ldap rdn or dn | 'cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com'
'PwLdapUser' | string | password for bind user |
'DnUserNode' | string | for user metods: set a DN where users are | 'ou=People,ou=ORG,dc=org,dc=example.com'
'protoVersion' | integer | ldap protocol version | 3
'debugLevel' | integer | Value for LDAP_OPT_DEBUG_LEVEL | 7
Var | Type | Desciption | Example
-- |-- |-- |--
`server` | string | Server connection with "ldap(s)://host[:port]" | 'ldaps://ldap.example.com'
`DnLdapUser` | string | Bind user as ldap rdn or dn | 'cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com'
`PwLdapUser` | string | password for bind user | 'PasswordOfLookupUser'
`DnUserNode` | string | for user metods: set a DN where users are | 'ou=People,ou=ORG,dc=org,dc=example.com'
`protoVersion` | integer | ldap protocol version | 3
`debugLevel` | integer | Value for LDAP_OPT_DEBUG_LEVEL when using debugOn() | 7
### Example:
As an example I create a hash named $aConfig and save it as "inc_config.php".
```php
return [
...
'ldap-master' => [
'server' => 'ldaps://ldap.example.com',
'DnLdapUser' => 'cn=Lookup,ou=Service,dc=some,dc=example.com',
'PwLdapUser' => 'PasswordOfLookupUser',
'DnUserNode' => 'ou=People,dc=some,dc=example.com',
'debugLevel' => 0,
],
...
];
```
```php
$aConfig = require_once('inc_config.php');
require_once '[APPROOT]/classes/ldap.class.php';
$oLdap=new imlldap($aConfig['ldap-maser']);
// ...
// update a single config item
$oLdap->setConfig([
'debugLevel' => 3,
]);
```
......@@ -10,7 +10,7 @@ $aUser = $oLdap->getUserInfo("john@example.com", ["memberof", "uid"]);
print_r($oLdap->normalizeSearchentry($aUser));
```
### Verify user and password for login
## Verify user and password for login
```php
// set values from $_FORM or $_POST data of your login form here
......@@ -32,18 +32,13 @@ $oLdap->close();
## Debugging
If you want to find connection problems then use debugOn().
This enables the echoing of ldap actions for connect, bind and more.
This enables the echoing of ldap actions for connect, bind and class internal debug messages.
```php
// this will set LDAP_OPT_DEBUG_LEVEL
$aConfig['debugLevel']=7;
$oLdap = new imlldap($aConfig);
// enable showing debug output
// This method sets LDAP_OPT_DEBUG_LEVEL to $aConfig['debugLevel'];
$oLdap->debugOn();
// then do something ... the first action will conect and bind
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment