I wish to give customers use of WebDav using Apache, but I wish to autenticate them first and provide each user use of a particular folder. All authentication should be done against a Django-based database. I'm able to obtain the Django-authentication working myself, however i need assistance using the part where I authenticate each user and give them a devoted webdav user-specific area.

Any hints?

First, for you personally other visitors, my authentication ended against Django utilizing a WSGI authentication script.

Then, there is the meat from the question, giving each Django user, within this situation, their very own WebDav dir separated using their company customers. Presuming the next WebDAV setup within the Apache virtual sites configuration (customarily in /etc/apache2/sites-enabled/)

<Directory /webdav/root/on/server>
        DAV On

        # No .htaccess allowed
        AllowOverride None      

        Options Indexes

        AuthType Basic
        AuthName "Login to your webdav area"
        Require valid-user
        AuthBasicProvider wsgi
        WSGIAuthUserScript  /where/is/the/authentication-script.wsgi
   </Directory>

Note how there is no public address for WebDav setup yet. This, and also the user area factor, is bound in 2 lines within the same config file (put these following the ending clause):

RewriteEngine On
RewriteRule ^/webdav-url/(.*?)$ /webdav/root/on/server/%{LA-U:REMOTE_USER}/$1

Now, webdav is utilized on http://my-server.com/webdav-url/ The consumer will get a login prompt and can then land inside a subdirectory towards the webdav root, getting exactly the same title his or her username. LA-U: makes Apache "look ahead" and allow the user register before identifying the mounting path, that is crucial since that path is dependent around the user title. Without some rewrite-rule there won't be any URL, and also the user will not obtain a login prompt. Quite simply, LA-U eliminates a catch-22 for this kind of login handling.

Safeguards: requires mod_rewrite to become enabled, and user names should be valid as dir names with no modification. Also, the consumer dirs will not be produced instantly by these instructions, so their existence should be assured in certain other.

You will probably find the apache mod_authn_dbd module provides you with what you would like. This module allows apache check an SQL database for authentication and authorization. You would employ this directive within the <Location>, <Directory> (etc) area that you're attempting to safeguard:

<Directory /usr/www/myhost/private>
    # other config ere
    # mod_authn_dbd SQL query to authenticate a user
    AuthDBDUserPWQuery \
         "SELECT password FROM authn WHERE user = %s"
 </Directory>

As it happens, what this means is you are authenticating against Django's database, not from the Django application itself. Note you have full treatments for the query, so that you can mix it along with other parameters in almost any tables to make certain the consumer is up to date, or perhaps in certain groups, or whatever, before permitting the authentication.

You may want to fuss around a little to make certain the hashing systems used are identical both in apache and django.

If the does not suit, consider moving your authentication from the django database into, say, an LDAP server. Having a custom authentication after sales (you will find existing LDAP implementations for django available), django will happily use LDAP... and LDAP auth/auth support in Apache is very robust.

I understand this now has wrinkles, and an addition... If you work with mod_python, you may even want to consider "Authenticating against Django’s user database from Apache" portion of Django documentation.