I guess you would have to subclass both RemoteUserMiddleware and
RemoteUserBackend. I'm not sure if this will work, but at least it's
one idea.

In your custom RemoteUserMiddleware you would have to set the header
property to HTTP_AUTHORIZATION so that Django knows where to find the
username.

    from django.contrib.auth.middleware import RemoteUserMiddleware

    class CustomHeaderMiddleware(RemoteUserMiddleware):
        header = 'HTTP_AUTHORIZATION'

Since the username is base64 encoded, I think you have to subclass
RemoteUserBackend and override the clean_username method:

    from django.contrib.backends import RemoteUserBackend

    class CustomRemoteUserBackend(RemoteUserBackend):
        def clean_username(username):
            # do some cleaning, e.g. base64 decoding
            return cleaned_username

- Sævar

On Aug 28, 5:58 pm, yupu <yupuli...@gmail.com> wrote:
> Dear Djangoer:
>
> I am new to Django. Please excuse me if the question is naive.
>
> I am trying to figure out if I could integrate my company's "access
> manager" with Django's authorization.
>
> Every time a user try to login my Django application, he/she got
> redirect to "access Manager" to put the company username and password
> in. Access Manager then does the authorization for me against the LDAP
> and pass the base64 encode username in the authorization header.
>
> I found the following doc helpful:http://docs.djangoproject.com/en/dev/
> howto/auth-remote-user/#.
>
> I guess my situation belongs to auth-remote-user with custom header
> but I am not sure how to subclass RemoteUserMiddleware.
>
> Thanks,
> Yupu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to