'Try to authenticate a user. This method will return a Django user object
if a user with the corresponding username exists in the database, and
if a record that links that user with an LTI user_id field exists in
the LtiUser collection.
If such a user is not found, the method returns None (in line with the
authentication backend specification).'

def authenticate(self, username=None, lti_user_id=None, lti_consumer=None):

    try:
        edx_user = User.objects.get(username=username)
    except User.DoesNotExist:
        return None
    try:
        LtiUser.objects.get(edx_user_id=edx_user.id, lti_user_id=lti_user_id, lti_consumer=lti_consumer)
    except LtiUser.DoesNotExist:
        return None
    return edx_user
