Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy in Documentation for RemoteUserBackend Usage #1514

Closed
meibenny opened this issue Apr 6, 2024 · 0 comments
Closed

Discrepancy in Documentation for RemoteUserBackend Usage #1514

meibenny opened this issue Apr 6, 2024 · 0 comments

Comments

@meibenny
Copy link

meibenny commented Apr 6, 2024

I've found that when using RemoteUserBackend, I need to pass remote_user in authenticate to log in my user, i.e.

user = authenticate(request, remote_user=remote_user.username)

Is this expected behavior?

The documentation for RemoteUserBackend states that it authenticates usernames that are found in request.META["REMOTE_USER"].

I was following the documentation to authenticate a user, e.g.

def myview(request):
    remote_user = remote_auth()
    request.META["REMOTE_USER"] = user.username
    user = authenticate(request)

In this case, however, user is None. My understanding of the documentation is that RemoteUserBackend would take the user's username from request.META["REMOTE_USER"]. However that doesn't seem to be the case. Indeed, the source code doesn't look at request.META["REMOTE_USER"] at all. Instead, it expects that the remote_user argument is passed by the caller.

@meibenny meibenny closed this as completed Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant