Abstract:
    Automatically create users based on the information from HTTP authentication

Idea:
    Organizations (i.e. universities, businesses, ...) often have a centralized
    user management. Unfortunately, moinmoin relies on its own user
    management, causing duplicate users definitions (thus increasing
    administration effort).

    This patch requires that the `auth_http_enabled` option is enabled. If so,
    the web server provides moinmoin with REMOTE_USER variable - uniquely
    identifying the user within the whole organization. This provides enough
    information for us to be able to collect other data necessary to create the
    user.

    This patch assures consistency of wiki-stored information, even after
    remote authentication for a particular user was disabled (i.e. the user
    was deleted).

Workflow:
    # request.py
    if self.user.isHttpAuthUser() and not self.user.exists():
            self.user.name = self.cfg.auth_http_usercreate_username_fct(self.user)
            if self.cfg.auth_http_usercreate_default_maildomain:
                self.user.email = "%s@%s" % \
                    (self.user.auth_username,
                    self.cfg.auth_http_usercreate_default_maildomain)
            self.user.save()
            self.setCookie()
            self.http_redirect("%s/UserPreferences" % self.getScriptname()) 

    # user.py::User
    def isHttpAuthUser (self):
        if self._cfg.auth_http_enabled:
            if self._cfg.auth_http_usercreate_pat:
                if self._cfg.auth_http_usercreate_pat.match(self.auth_username):
                    return True
        return False

    If the patch is enabled, UserPreferences doesn't allow to do the following:
        * Change User Name: changing user name would result in creating the 
                            user again and again, every time after he changes
                            the name.
        * Logout:   It makes no sense to change the identity as the
                    authentication is done externally
        * Password: Also not needed, as the authentication is done externally

Config Options (and their default values):
    # this should be a instance returned by:
    # re.compile("automatically_create_users_matching_this_pattern") 
    config.auth_http_usercreate_pat = None

    # feel free to use a sophisticated function here, which will perform
    # /etc/passwd or LDAP lookup for example ...
    config.auth_http_username_fct = lambda user : user.auth_username

    # domain used on http authenticated user generation if enabled
    config.auth_http_usercreate_default_maildomain = ""
