From 3cf94a3dbf80f3599839d9bf815075e32828b466 Mon Sep 17 00:00:00 2001
From: Sinisa Veseli <sveseli@aps.anl.gov>
Date: Mon, 13 Apr 2015 13:09:08 +0000
Subject: [PATCH] renamed method to check credentials

---
 src/python/dm/common/service/dmSessionController.py |  2 +-
 src/python/dm/common/service/loginController.py     | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/python/dm/common/service/dmSessionController.py b/src/python/dm/common/service/dmSessionController.py
index 7ff6f009..33af1a21 100755
--- a/src/python/dm/common/service/dmSessionController.py
+++ b/src/python/dm/common/service/dmSessionController.py
@@ -22,7 +22,7 @@ class DmSessionController(DmController):
 
     #auth = LoginController()
     # Add before_handler for authorization
-    cherrypy.tools.auth = cherrypy.Tool('before_handler', LoginController.checkAuthorization)
+    cherrypy.tools.auth = cherrypy.Tool('before_handler', LoginController.authCheck)
 
     def __init__(self):
         DmController.__init__(self)
diff --git a/src/python/dm/common/service/loginController.py b/src/python/dm/common/service/loginController.py
index 4c57b874..9b2e6bb3 100755
--- a/src/python/dm/common/service/loginController.py
+++ b/src/python/dm/common/service/loginController.py
@@ -12,7 +12,7 @@ from dm.common.exceptions.dmHttpError import DmHttpError
 from dm.common.exceptions.authorizationError import AuthorizationError
 from dm.common.utility.loggingManager import LoggingManager
 from dm.common.service.dmController import DmController
-from dm.common.service.impl.authorizationManager import AuthorizationManager
+from dm.common.service.auth.authorizationPrincipalManager import AuthorizationPrincipalManager
 
 class LoginController(DmController):
     """ Controller to provide login and logout actions. """
@@ -91,8 +91,8 @@ class LoginController(DmController):
         logger.debug('Checking credential for User: %s' % (username))
         #logger.debug('Checking credential for User: %s, Password: %s' % (username, password))
         logger.debug('Session id: %s' % cherrypy.serving.session.id)
-        principal = AuthorizationManager.getInstance().getAuthorizationPrincipal(username, password)
-        logger.debug('Principal: %s' % (principal))
+        principal = AuthorizationPrincipalManager.getInstance().getAuthenticatedAuthorizationPrincipal(username, password)
+        #logger.debug('Principal: %s' % (principal))
         if principal:
             cherrypy.session[LoginController.SESSION_ROLE_KEY] = principal.getRole()
             logger.debug('Successful login from user: %s (role: %s)' % (username, principal.getRole()))
@@ -107,13 +107,13 @@ class LoginController(DmController):
         return principal
 
     @classmethod
-    def checkAuthorization(cls, *args, **kwargs):
+    def authCheck(cls, *args, **kwargs):
         """
         A tool that looks in config for 'auth.require'. If found and it
         is not None, a login is required and the entry is evaluated as a list of
         conditions that the user must fulfill.
         """
-        logger = LoggingManager.getInstance().getLogger('LoginController:checkAuthorization')
+        logger = LoggingManager.getInstance().getLogger('LoginController:authCheck')
         conditions = cherrypy.request.config.get('auth.require', None)
         #logger.debug('Headers: %s' % (cherrypy.request.headers))
         #logger.debug('Request params: %s' % (cherrypy.request.params))
-- 
GitLab