[Fusionforge-commits] r12812 - in trunk/src: common/include plugins/authcas/include plugins/authhttpd/include plugins/authldap/include

Roland Mas lolando at fusionforge.org
Wed Mar 16 22:01:50 CET 2011


Author: lolando
Date: 2011-03-16 22:01:50 +0100 (Wed, 16 Mar 2011)
New Revision: 12812

Modified:
   trunk/src/common/include/AuthPlugin.class.php
   trunk/src/plugins/authcas/include/AuthCASPlugin.class.php
   trunk/src/plugins/authhttpd/include/AuthHTTPDPlugin.class.php
   trunk/src/plugins/authldap/include/AuthLDAPPlugin.class.php
Log:
Factor default cookie name for auth* plugins

Modified: trunk/src/common/include/AuthPlugin.class.php
===================================================================
--- trunk/src/common/include/AuthPlugin.class.php	2011-03-16 21:01:31 UTC (rev 12811)
+++ trunk/src/common/include/AuthPlugin.class.php	2011-03-16 21:01:50 UTC (rev 12812)
@@ -157,20 +157,27 @@
 	}
 	
 	// Helper functions for individual plugins
-	protected $cookie_name = 'forge_session';
+	protected $cookie_name;
 
+	protected function getCookieName() {
+		if ($this->cookie_name) {
+			return $this->cookie_name;
+		}
+		return 'forge_session_'.$this->name;
+	}
+
 	protected function checkSessionToken($token) {
 		return session_check_session_token($token);
 	}
 
 	protected function checkSessionCookie() {
-		$token = getStringFromCookie($this->cookie_name);
+		$token = getStringFromCookie($this->getCookieName());
 		return $this->checkSessionToken($token);
 	}
 
 	protected function setSessionCookie() {
 		$cookie = session_build_session_token($this->saved_user->getID());
-		session_set_cookie($this->cookie_name, $cookie, "", forge_get_config('session_expire'));
+		session_set_cookie($this->getCookieName(), $cookie, "", forge_get_config('session_expire'));
 	}
 
 	/**
@@ -194,7 +201,7 @@
 	}
 
 	protected function unsetSessionCookie() {
-		session_set_cookie($this->cookie_name, '');
+		session_set_cookie($this->getCookieName(), '');
 	}
 
 	/**

Modified: trunk/src/plugins/authcas/include/AuthCASPlugin.class.php
===================================================================
--- trunk/src/plugins/authcas/include/AuthCASPlugin.class.php	2011-03-16 21:01:31 UTC (rev 12811)
+++ trunk/src/plugins/authcas/include/AuthCASPlugin.class.php	2011-03-16 21:01:50 UTC (rev 12812)
@@ -44,8 +44,6 @@
 		$this->saved_login = '';
 		$this->saved_user = NULL;
 
-		$this->cookie_name = 'forge_session_cas';
-
 		$this->declareConfigVars();
 	}
 

Modified: trunk/src/plugins/authhttpd/include/AuthHTTPDPlugin.class.php
===================================================================
--- trunk/src/plugins/authhttpd/include/AuthHTTPDPlugin.class.php	2011-03-16 21:01:31 UTC (rev 12811)
+++ trunk/src/plugins/authhttpd/include/AuthHTTPDPlugin.class.php	2011-03-16 21:01:50 UTC (rev 12812)
@@ -40,8 +40,6 @@
 		$this->saved_login = '';
 		$this->saved_user = NULL;
 
-		$this->cookie_name = 'forge_session_httpd';
-
 		$this->declareConfigVars();
 	}
 

Modified: trunk/src/plugins/authldap/include/AuthLDAPPlugin.class.php
===================================================================
--- trunk/src/plugins/authldap/include/AuthLDAPPlugin.class.php	2011-03-16 21:01:31 UTC (rev 12811)
+++ trunk/src/plugins/authldap/include/AuthLDAPPlugin.class.php	2011-03-16 21:01:50 UTC (rev 12812)
@@ -44,8 +44,6 @@
 		$this->_addHook("sync_account_info");
 		$this->_addHook("close_auth_session");
 
-		$this->cookie_name = 'forge_session_authldap';
-
 		$this->ldap_conn = false;
 		$this->saved_login = '';
 		$this->saved_password = '';




More information about the Fusionforge-commits mailing list