[X2Go-Commits] x2gobroker.git - build-main (branch) updated: b0cdf44c0b3188da332f410a41414cc8221452b3

X2Go dev team git-admin at x2go.org
Sun May 19 13:04:32 CEST 2013


The branch, build-main has been updated
       via  b0cdf44c0b3188da332f410a41414cc8221452b3 (commit)
      from  499105e333bc9b5ca4242d080f4ae0bce5e4e80e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/backends/base.py |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

The diff of changes is:
diff --git a/x2gobroker/backends/base.py b/x2gobroker/backends/base.py
index afff442..9a1d133 100644
--- a/x2gobroker/backends/base.py
+++ b/x2gobroker/backends/base.py
@@ -119,17 +119,25 @@ class X2GoBroker(object):
         #}
         return 'OK'
 
-    def _check_access(self, username='', password='', authid=None):
+    def _auth_mech_pam(self, username='', password=''):
+
+        # do a simple PAM authentication against the PAM service ,,x2gobroker''
+        if username and password:
+            if pam.authenticate(username, password, service="x2gobroker"):
+                return True
+
+    def _auth_mech_htpasswd(self, username='', password=''):
+
+        ### TODO: implement an authentication mechanism that can use htpasswd files
+        return False
+
+    def _do_authenticate(self, username='', password=''):
 
         if self.config.get_value(self.backend_name, 'auth-mech').lower() == 'pam':
-            # do a simple PAM authentication against the PAM service ,,x2gobroker''
-            if username and password:
-                if pam.authenticate(username, password, service="x2gobroker"):
-                    return True
+            return self._auth_mech_pam(username=username, password=password)
 
         elif self.config.get_value(self.backend_name, 'auth-mech').lower() == 'htpasswd':
-            ### TODO: implement an authentication mechanism that can use htpasswd files
-            pass
+            return self._auth_mech_htpasswd(username=username, password=password)
 
         return False
 
@@ -153,11 +161,11 @@ class X2GoBroker(object):
         if not self.config.get_value('global', 'check-credentials'):
             return True
 
-        ### IMPLEMENT YOUR AUTHENTICATION LOGIC IN THE self._check_access(**kwargs) METHOD
+        ### IMPLEMENT YOUR AUTHENTICATION LOGIC IN THE self._do_authenticate(**kwargs) METHOD
         ### when inheriting from the base.X2GoBroker class.
 
         access = False
-        access = self._check_access(username=username, password=password, authid=authid)
+        access = self._do_authenticate(username=username, password=password, authid=authid)
 
         # using authid as extra security?
         if self.config.get_value('global', 'use-authid'):


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list