'The username passed as ``remote_user`` is considered trusted.  This
method simply returns the ``User`` object with the given username,
creating a new ``User`` object if ``create_unknown_user`` is ``True``.
Returns None if ``create_unknown_user`` is ``False`` and a ``User``
object with the given username is not found in the database.'

def authenticate(self, remote_user):

    if (not remote_user):
        return
    user = None
    username = self.clean_username(remote_user)
    if self.create_unknown_user:
        (user, created) = User.objects.get_or_create(username=username)
        if created:
            user = self.configure_user(user)
    else:
        try:
            user = User.objects.get(username=username)
        except User.DoesNotExist:
            pass
    return user
