[icinga-checkins] icinga.org: icinga-web/master: * Added auth_strip_domain (fixes #1294) and lowercase to ldap name

git at icinga.org git at icinga.org
Thu Apr 14 08:15:10 CEST 2011


Module: icinga-web
Branch: master
Commit: 496f6126f2dee3608ddd78b637d10e30b5420123
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=496f6126f2dee3608ddd78b637d10e30b5420123

Author: jmosshammer <jannis.mosshammer at netways.de>
Date:   Thu Apr 14 08:13:59 2011 +0200

* Added auth_strip_domain (fixes  #1294) and lowercase to ldap name
comparisons (fixes #1293) thx to tgelf

---

 .../HTTPBasicAuthenticationModel.class.php         |   14 ++++++++++++--
 .../models/Auth/Provider/LDAPModel.class.php       |    2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/app/modules/AppKit/models/Auth/Provider/HTTPBasicAuthenticationModel.class.php b/app/modules/AppKit/models/Auth/Provider/HTTPBasicAuthenticationModel.class.php
index fea642e..8f4878b 100644
--- a/app/modules/AppKit/models/Auth/Provider/HTTPBasicAuthenticationModel.class.php
+++ b/app/modules/AppKit/models/Auth/Provider/HTTPBasicAuthenticationModel.class.php
@@ -74,7 +74,17 @@ class AppKit_Auth_Provider_HTTPBasicAuthenticationModel extends AppKitAuthProvid
 		foreach (self::$source_map as $class_target => $config_target) {
 			$search_keys = AppKitArrayUtil::trimSplit($this->getParameter($config_target, self::$source_map_defaults[$class_target]));
 			if (isset($search_keys[0]) && ($search_value = $source->getParameter($search_keys[0])) ) {
-				$this->{ $class_target } = $search_value;
+				if ($class_target == 'auth_name') {
+					$search_value = strtolower($search_value);
+					if ($strip = strtolower($this->getParameter('auth_strip_domain', ''))) {
+						$m = '~@' . preg_quote($strip, '~') . '~';
+						$this->{ $class_target } = preg_replace($m, '', $search_value);
+					} else {
+						$this->{ $class_target } = $search_value;
+					}
+				} else {
+					$this->{ $class_target } = $search_value;
+				}
 			}
 		}
 
@@ -97,4 +107,4 @@ class AppKit_Auth_Provider_HTTPBasicAuthenticationModel extends AppKitAuthProvid
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/app/modules/AppKit/models/Auth/Provider/LDAPModel.class.php b/app/modules/AppKit/models/Auth/Provider/LDAPModel.class.php
index 56b4fc1..976e0f9 100755
--- a/app/modules/AppKit/models/Auth/Provider/LDAPModel.class.php
+++ b/app/modules/AppKit/models/Auth/Provider/LDAPModel.class.php
@@ -68,7 +68,7 @@ class AppKit_Auth_Provider_LDAPModel extends AppKitAuthProviderBaseModel impleme
 		if (is_array($data)) {
 			$re = (array)$this->mapUserdata($data);
 			$re['user_authid'] = $data['dn'];
-			$re['user_name'] = $data[$this->getParameter('ldap_userattr', 'uid')];
+			$re['user_name'] = strtolower($data[$this->getParameter('ldap_userattr', 'uid')]);
 			$re['user_disabled'] = 0;
 		}
 		





More information about the icinga-checkins mailing list