Skip to content

Commit 6078136

Browse files
authored
Rely on attributes map for last authentication attribute (#321)
* Rely on attributes map for last authentication attribute * Change documentation for lastauth attribute and add upgrade note
1 parent 35ab002 commit 6078136

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

conf/config.inc.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
$ldap_ppolicy_name_attribute = "cn";
3939
$ldap_size_limit = 100;
4040
#$ldap_default_ppolicy = "cn=default,ou=ppolicy,dc=example,dc=com";
41-
$ldap_lastauth_attribute = "authTimestamp";
4241
#$ldap_network_timeout = 10;
4342
$ldap_page_size = 0;
4443

docs/ldap-parameters.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,20 @@ You can override some policies, like lockout duration or password maximal age:
137137
Last authentication attribute
138138
-----------------------------
139139

140-
The last authentication date can be stored in different attributes depending on your OpenLDAP version or configuration.
140+
The last authentication date can be stored in different attributes depending on your LDAP directory version or configuration.
141+
142+
For example, for OpenLDAP, to use ``pwdLastSuccess`` instead of ``authTimestamp``:
141143

142144
.. code-block:: php
143145
144-
$ldap_lastauth_attribute = "pwdLastSuccess";
146+
$openldap_attributes_map['authtimestamp']['attribute'] = "pwdlastsuccess";
147+
148+
149+
For Active Directory, to use ``lastlogontimestamp`` (replicated againts all DC) instead of ``lastlogon`` (updated only on the targeted DC):
150+
151+
.. code-block:: php
145152
146-
.. tip:: This attribute is automatically configured for Active Directory.
153+
$activedirectory_attributes_map['authtimestamp']['attribute'] = "lastlogontimestamp";
147154
148155
Samba 3
149156
-------

docs/upgrade.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ If you want to use this feature, be sure to configure what is needed to read gro
1717

1818
* :doc:`Group membership<groupmembership>`
1919

20+
Last authentication time attribute
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
23+
Configuration parameter ``$ldap_lastauth_attribute`` has been removed.
24+
25+
If you configured a specific value for it, which was possible for OpenLDAP to use ``pwdLastSuccess`` instead of ``authTimestamp``, then you must change your settings:
26+
27+
.. code-block:: php
28+
29+
$openldap_attributes_map['authtimestamp']['attribute'] = "pwdlastsuccess";
2030
2131
From 0.7 to 0.8
2232
---------------

htdocs/api/search-api.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
date_sub( $dateIdle, new DateInterval('P'.$idledays.'D') );
5454
$dateIdleLdap = $directory->getLdapDate($dateIdle);
5555
# Search filter
56+
$ldap_lastauth_attribute = $attributes_map['authtimestamp']['attribute'];
5657
$ldap_filter = "(&".$ldap_user_filter."(|(!(".$ldap_lastauth_attribute."=*))(".$ldap_lastauth_attribute."<=".$dateIdleLdap.")))";
5758
$ldap_search_filter = $ldap_filter;
5859
break;

htdocs/index.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,12 @@
9595
# Load specific directory settings
9696
switch($ldap_type) {
9797
case "openldap":
98-
$openldap_attributes_map['authtimestamp']['attribute'] = strtolower($ldap_lastauth_attribute);
9998
$attributes_map = array_merge($attributes_map, $openldap_attributes_map);
10099
$directory = new \Ltb\Directory\OpenLDAP();
101100
break;
102101
case "activedirectory":
103102
$attributes_map = array_merge($attributes_map, $activedirectory_attributes_map);
104103
$directory = new \Ltb\Directory\ActiveDirectory();
105-
$ldap_lastauth_attribute = "lastLogon";
106104
break;
107105
}
108106

0 commit comments

Comments
 (0)