Last active
June 10, 2019 18:31
-
-
Save yannbriancon/63798c31fb4249b5e790a8f3625d6736 to your computer and use it in GitHub Desktop.
Update custom Django authentication backend to get the credentials from the query strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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