Monday, April 2, 2012

Re: Mapping SSL certificates to django users

On Mon, Apr 2, 2012 at 2:03 PM, Tomas Kouba <tomas@jikos.cz> wrote:
> Hello,
>
> how can I map a DN (or any other part of X509 certificate) to a django user?
>
> I have found a documentation article about django middleware using
> REMOTE_USER
> transferred from apache, but I am not sure if this is the way and if yes how
> to
> - tell apache that a given part of X509 certificate should go to REMOTE_USER

This is covered by Apache's mod_ssl docs:

http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslusername

> - map REMOTE_USER strings to django users

This you will have to do yourself. It's quite easy, simply extend
django.contrib.auth.backends.RemoteUserBackend, override the
clean_username() method to correctly extract the username from
whatever bit of the certificate you placed in REMOTE_USER, and set
that as one of your AUTHENTICATION_BACKENDS.

Cheers

Tom

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment