

def _authorizedResource(self, request):
    '\n        Get the L{IResource} which the given request is authorized to receive.\n        If the proper authorization headers are present, the resource will be\n        requested from the portal.  If not, an anonymous login attempt will be\n        made.\n        '
    authheader = request.getHeader(b'authorization')
    if (not authheader):
        return util.DeferredResource(self._login(Anonymous()))
    (factory, respString) = self._selectParseHeader(authheader)
    if (factory is None):
        return UnauthorizedResource(self._credentialFactories)
    try:
        credentials = factory.decode(respString, request)
    except error.LoginFailed:
        return UnauthorizedResource(self._credentialFactories)
    except:
        log.err(None, 'Unexpected failure from credentials factory')
        return ErrorPage(500, None, None)
    else:
        return util.DeferredResource(self._login(credentials))

dataset/ETHPy150Open twisted/twisted/twisted/web/_auth/wrapper.py HTTPAuthSessionWrapper._authorizedResource/original