def authenticate_credentials(self, userargs, password, request=None):
credentials = {<EOL>'<STR_LIT:password>': password<EOL>}<EOL>if "<STR_LIT:=>" not in userargs:<EOL><INDENT>credentials[get_user_model().USERNAME_FIELD] = userargs<EOL><DEDENT>else:<EOL><INDENT>for arg in userargs.split("<STR_LIT:&>"):<EOL><INDENT>key, val = arg.split("<STR_LIT:=>")<EOL>credentials[key] = val<EOL><DEDENT><DEDENT>user = authenticate(**credentials)<EOL>if user is None:<EOL><INDENT>raise exceptions.AuthenticationFailed('<STR_LIT>')<EOL><DEDENT>if not user.is_active:<EOL><INDENT>raise exceptions.AuthenticationFailed('<STR_LIT>')<EOL><DEDENT>return (user, None)<EOL>
Authenticate the userargs and password against Django auth backends.
The "userargs" string may be just the username, or a querystring-encoded set of params.