magus wrote:
> I'd like to roll my own basic authentication for a web service, i.e. I
> don't want to use the contrib.auth module. If possible I'd like to
> avoid relying on the server for this. Anyone who can offer some
> pointers on how to raise a 401 on a request that doesn't contain the
> Authentication: header?
>
> The 401 also needs to contain the realm, how would I do that?
>
> /M

Something like this?

response = HttpResponse()
response.status_code = 401
response['WWW-Authenticate'] = 'Basic realm="%s:%s' % (
           request.META["SERVER_NAME"], request.META["SERVER_PORT"])
return response


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to