Skip to content

Conversation

@ganiserb
Copy link
Contributor

@ganiserb ganiserb commented May 24, 2016

This way, when using multiple authentication backends (ie, a custom django auth backend and custom Saml2Backend) and the first custom backend does not authenticate the user, this other backend can process the next authentication request attempt without crashing.

For example: I have password auth backend and djangosaml2 backend for my site. A user wants to authenticate using password. Let's say the user cannot authenticate with password because of reasons (like... he is only allowed to log in through SSO and my custom auth backend checks for that).

When auth backends says no to password login, django tries djangosaml2 backend passing as kwargs the username and password. These are unexpected keyword arguments for djangosaml2 backend, but it should still be supported as **kwargs so that authentication does not blow up when using multiple backends.

If you look at the code for Auth.ModelBackend you will see that the authenticate method signature contains a **kwargs for this very reason.

This way, when using multiple authentication backends (ie, a custom django auth backend and custom Saml2Backend) and the first custom backend does not authenticate the user, this other backend can process the next authentication request attempt without crashing.
@knaperek knaperek merged commit 9917ae5 into IdentityPython:master May 26, 2016
@knaperek
Copy link
Collaborator

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants