Im developing small intranet web service. I want authenticate users over 
kerberos in MS AD or with basic auth. For that reason i need to set two 
'WWW-Authenticate' http headers in response 401. How can i do it with 
Django ?

Should be something like this:

Client: GET www/index.html
Server: HTTP/1.1 401 Unauthorized
        WWW-Authenticate: Negotiate
        WWW-Authenticate: Basic realm="corp site"

This code overwrite header:

def auth(request):
    response = None
    auth = request.META.get('HTTP_AUTHORIZATION')
    if not auth:
        response = HttpResponse(status = 401)
        response['WWW-Authenticate'] = 'Negotiate'
        response['WWW-Authenticate'] = 'Basic realm="  trolls place basic auth"'

    elif auth.startswith('Negotiate YII'):
        ...

    return response

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a2d398b-bf7c-4241-84c3-4dc19a9cdcd6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to