diff --git a/src/python/dm/common/service/dmSessionController.py b/src/python/dm/common/service/dmSessionController.py index 7ff6f009f53465ef4613aecef54551e1d725b9d4..33af1a21b9596aa2c448f623e4ce895f2e1899ba 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 4c57b874a85a6f993582ba1e86e25e17d3f67b35..9b2e6bb310b4554952054f3a649b6bd73bfd4d8f 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))