Skip to content

Instantly share code, notes, and snippets.

@yannbriancon
Last active June 10, 2019 18:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Update custom Django authentication backend to get the credentials from the query strings
import ...
class AuthenticationBackend(ModelBackend):
def authenticate(self, request, username=None, password=None, **kwargs):
# Get credentials from the query strings
username = request.GET.get('username')
password = request.GET.get('password')
# Check that the user can authenticate in the LDAP using its username and password
if get_LDAP_user(username, password) is None:
return None
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment