Changeset - 8b8f51f36542
[Not reviewed]
default
0 1 0
Søren Løvborg - 11 years ago 2015-07-26 13:58:50
kwi@kwi.dk
auth: actually use _determine_auth_user argument

Fix silly mistake which slipped through the review. (We should not look
up the session cookie again, when it's passed as a function argument.)
1 file changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/base.py
Show inline comments
 
@@ -379,30 +379,29 @@ class BaseController(WSGIController):
 
    def _determine_auth_user(api_key, session_authuser):
 
        """
 
        Create an `AuthUser` object given the IP address of the request, the
 
        API key (if any), and the authuser from the session.
 
        """
 

	
 
        # Authenticate by API key
 
        if api_key:
 
            # when using API_KEY we are sure user exists.
 
            return AuthUser(api_key=api_key, is_external_auth=True)
 

	
 
        # Authenticate by session cookie
 
        cookie = session.get('authuser')
 
        # In ancient login sessions, 'authuser' may not be a dict.
 
        # In that case, the user will have to log in again.
 
        if isinstance(cookie, dict):
 
        if isinstance(session_authuser, dict):
 
            try:
 
                return AuthUser.from_cookie(cookie)
 
                return AuthUser.from_cookie(session_authuser)
 
            except UserCreationError as e:
 
                # container auth or other auth functions that create users on
 
                # the fly can throw UserCreationError to signal issues with
 
                # user creation. Explanation should be provided in the
 
                # exception object.
 
                from kallithea.lib import helpers as h
 
                h.flash(e, 'error', logf=log.error)
 

	
 
        # Authenticate by auth_container plugin (if enabled)
 
        if any(
 
            auth_modules.importplugin(name).is_container_auth
 
            for name in Setting.get_auth_plugins()
0 comments (0 inline, 0 general)