***Xenforo Authentication***

This code allows you to integrate MoinMoin with Xenforo. It authenticates against Xenforo, and automatically creates the user if they do not exist.

    if we have a cookie in the format: xf_session=bxxxx27f98162681a2b45150fe36065b
    then we look in the xf_session table for session_id = <cookie>.
    if the row doesn't exist, deny
    if that row exists, it will be like:
        session_id = bxxxx27f98162681a2b45150fe36065b
        session_data = a:7:{s:12:"sessionStart";i:1342373577;s:2:"ip";b:0;s:7:"user_id";i:1;s:16:"previousActivity";i:1342373565;s:16:"dismissedNotices";a:0:{}s:12:"reportCounts";a:3:{s:5:"total";i:0;s:8:"assigned";i:0;s:13:"lastBuildDate";i:1342373577;}s:16:"moderationCounts";a:2:{s:5:"total";i:0;s:13:"lastBuildDate";i:1342373577;}}
        expiry_date = 1342378332
    if now() > expiry_date then deny
    else we then parse out the user_id;i;1;s;16 bit.
    The user_id == 1 from above, we look for in xf_user table:
        user_id == 1
        username == donbowman

To use, put the attached file in MoinMoin/auth (the same directory as e.g. http.py, log.py, openidrp.py).

In your wikiconfig.py file, put this line near the top: from MoinMoin.auth.xenforo import XenforoAuth

Then later in the file (after the superuser line), put:

    auth = [XenforoAuth(autocreate=True)]
    auth_xenforo_verbose = True # or False
    auth_xenforo_mysql_host = 'localhost'
    auth_xenforo_mysql_db = 'xenforo'
    auth_xenforo_mysql_user = 'xenforo'
    auth_xenforo_mysql_pass = 'xenforo'
    user_autocreate=True

and fill in the parameters for your mysql db that xenforo is using.

MoinMoin: DonBowman/XenforoAuth (last edited 2012-07-16 07:24:16 by ip-80-226-24-6)