From 1539449b51e3b4411617ab79b9a07962fc275077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Sun, 8 Nov 2020 17:51:02 +0200 Subject: [PATCH 1/7] Add LDAP configuration example for Active Directory Also, add missing documentation regarding map_dn parameter and make it clear that referrals should be disabled for all new Windows versions. --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f85a5a9..0250907 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ group_indentifier: cn map_username: uid map_fullname: givenName lastName map_email: mail +map_dn: distinguishedName save_grav_user: false store_ldap_data: false default_access_levels: @@ -78,7 +79,7 @@ default_access_levels: |version|LDAP Version 3 is most popular (only change this if you know what you are doing) | [default: `3`] | |ssl|Enable SSL for the connection (typically for port 636 or 3269) | `true` \| [default: `false`] | |start_tls|Negotiate TLS encryption with the LDAP server (requires all traffic to be encrypted) | `true` \| [default: `false`] | -|opt_referrals|Sets the value of LDAP_OPT_REFERRALS (Set to "off" for Windows 2003 servers) | `true` \| [default: `false`] | +|opt_referrals|Sets the value of LDAP_OPT_REFERRALS (turn it off for Windows 2003 and later servers) | `true` \| [default: `false`] | ### LDAP Configuration @@ -92,6 +93,23 @@ default_access_levels: |map_username|LDAP Attribute(s) that contains the user's username | [default: `uid`] | |map_fullname|LDAP Attribute(s) that contains the user's full name | [default: `givenName lastName`] | |map_email|LDAP Attribute(s) that contains the user's email address | [default: `mail`] | +|map_dn|LDAP Attribute that contains the user's DN String | [default: `distinguishedName`] | + +### Examples + +#### Active Directory with pre-Windows 2000 style login + +|Key | Value | +|:---------------------|:-------| +|user_dn| `YOURDOMAIN\[username]` | +|search_dn| `ou=users,dc=yourdomain,dc=local` | +|group_dn| `ou=groups,dc=yourdomain,dc=local` | +|group_query| `(&(cn=*)(member=[dn]))` or `(&(cn=*)(member:1.2.840.113556.1.4.1941:=[dn]))` for nested group support | +|group_indentifier| `cn` | +|map_username| `sAMAccountName` | +|map_fullname| `displayName` | +|map_email| `mail` | +|map_dn| `distinguishedName` | ### Advanced Configuration From bcdd625f131bb3283a9b387fc769e1b894a71bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Sun, 8 Nov 2020 17:58:08 +0200 Subject: [PATCH 2/7] gramar fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0250907..2368fa1 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ default_access_levels: ### Examples -#### Active Directory with pre-Windows 2000 style login +#### Active Directory with pre-Windows 2000 style logins |Key | Value | |:---------------------|:-------| From 2e60a751181d706b2be1ea07c34838d14feb7136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Wed, 8 Mar 2023 22:41:16 +0200 Subject: [PATCH 3/7] Stop event propagation on empty username --- login-ldap.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/login-ldap.php b/login-ldap.php index 5ade99e..740a587 100644 --- a/login-ldap.php +++ b/login-ldap.php @@ -70,10 +70,11 @@ class LoginLDAPPlugin extends Plugin public function userLoginAuthenticate(UserLoginEvent $event) { $credentials = $event->getCredentials(); - - // empty username -> ignore + + // Fail early on empty username if($credentials['username'] == ''){ $event->setStatus($event::AUTHENTICATION_FAILURE); + $event->stopPropagation(); return; } From f25765e36f82340807017127136109ed0470e578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Wed, 8 Mar 2023 23:41:31 +0200 Subject: [PATCH 4/7] Better grammar logic --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2368fa1..f67cf82 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ default_access_levels: |version|LDAP Version 3 is most popular (only change this if you know what you are doing) | [default: `3`] | |ssl|Enable SSL for the connection (typically for port 636 or 3269) | `true` \| [default: `false`] | |start_tls|Negotiate TLS encryption with the LDAP server (requires all traffic to be encrypted) | `true` \| [default: `false`] | -|opt_referrals|Sets the value of LDAP_OPT_REFERRALS (turn it off for Windows 2003 and later servers) | `true` \| [default: `false`] | +|opt_referrals|Sets the value of LDAP_OPT_REFERRALS (leave it disabled for Windows 2003 and later servers) | `true` \| [default: `false`] | ### LDAP Configuration From f705d41d8c7f0d16c1c857398099c9547208a191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilius=20=C5=A0umskas?= Date: Tue, 16 Apr 2024 13:21:43 +0300 Subject: [PATCH 5/7] Fix plugin installation under PHP 8.1 --- blueprints.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/blueprints.yaml b/blueprints.yaml index 4141bf9..2bce5cb 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -219,7 +219,6 @@ form: type: commalist blacklist_ldap_fields: - type: array type: array value_only: true label: PLUGIN_LOGIN_LDAP.BLACKLIST_FIELDS From 100ae5923aedbf15fd84c4bc37ef6833e21e9cfc Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 16 Apr 2024 11:15:09 -0600 Subject: [PATCH 6/7] updated changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3fa18..b39f1c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.1.0 +## 04/16/2024 + +1. [](#improved) + * Stop event propagation on empty username [#27](https://github.com/trilbymedia/grav-plugin-login-ldap/pulls/27) + * Add LDAP configuration example for Active Directory [#19](https://github.com/trilbymedia/grav-plugin-login-ldap/pulls/19) + * Fix plugin installation under PHP 8.1 [#31](https://github.com/trilbymedia/grav-plugin-login-ldap/pulls/31) + # v1.0.2 ## 11/16/2020 From 26750b931a8cea8e60979b9d521b07f893b79415 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 16 Apr 2024 11:16:43 -0600 Subject: [PATCH 7/7] prepare for release --- blueprints.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints.yaml b/blueprints.yaml index 2bce5cb..66b63e8 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Login LDAP -version: 1.0.2 +version: 1.1.0 description: Allows for Grav user authentication against an LDAP Server such as OpenLDAP or ActiveDirectory icon: user-circle-o author: