'Return the authenticated userid or ``None``.
If no callback is registered, this will be the same as
``unauthenticated_userid``.
If a ``callback`` is registered, this will return the userid if
and only if the callback returns a value that is not ``None``.'

def authenticated_userid(self, request):

    identity = self._get_identity(request)
    if (identity is None):
        (self.debug and self._log('repoze.who    identity    is    None,    returning    None', 'authenticated_userid', request))
        return None
    userid = identity['repoze.who.userid']
    if (userid is None):
        (self.debug and self._log(('repoze.who.userid    is    None,    returning    None' % userid), 'authenticated_userid', request))
        return None
    if (self._clean_principal(userid) is None):
        (self.debug and self._log(('use    of    userid    %r    is    disallowed    by    any    built-in    Pyramid    security    policy,    returning    None' % userid), 'authenticated_userid', request))
        return None
    if (self.callback is None):
        return userid
    if (self.callback(identity, request) is not None):
        return userid
