示例#1
0
 def _loginFailed(self, result):
     """
     Handle login failure by presenting either another challenge (for
     expected authentication/authorization-related failures) or a server
     error page (for anything else).
     """
     if result.check(credError.Unauthorized, credError.LoginFailed):
         return UnauthorizedResource(self._credentialFactories)
     else:
         log.err(
             result,
             "HTTPAuthSessionWrapper.getChildWithDefault encountered "
             "unexpected error")
         return ErrorPage(500, None, None)
示例#2
0
    def _authorizedResource(self, request):
        """
        Get the L{IResource} which the given request is authorized to receive.
        If the proper authorization headers are present, the resource will be
        requested from the portal.  If not, an anonymous login attempt will be
        made.
        """
        authheader = request.getHeader('authorization')
        if not authheader:
            return UnauthorizedResource(self._credentialFactories)

        factory, respString = self._selectParseHeader(authheader)
        if factory is None:
            return UnauthorizedResource(self._credentialFactories)
        try:
            credentials = factory.decode(respString, request)
        except credError.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))
示例#3
0
文件: server.py 项目: jrydberg/distfs
 def __init__(self, message="Sorry, that resource already exists."):
     ErrorPage.__init__(self, http.CONFLICT, "Conflict", message)
示例#4
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.UNAUTHORIZED]):
     ErrorPage.__init__(self, http.UNAUTHORIZED,
                        http.RESPONSES[http.UNAUTHORIZED], message)
示例#5
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.UNSUPPORTED_MEDIA_TYPE]):
     ErrorPage.__init__(self, http.UNSUPPORTED_MEDIA_TYPE,
                        http.RESPONSES[http.UNSUPPORTED_MEDIA_TYPE], message)
示例#6
0
 def __init__(self, message='Sorry, we could not find that resource.'):
     TwistedErrorPage.__init__(self, http.NOT_FOUND, 'No Such Resource',
                               message)
示例#7
0
 def __init__(self, status, brief, detail, errorClassName):
     self.errorClassName = errorClassName
     TwistedErrorPage.__init__(self, status, brief, detail)
示例#8
0
 def render(self, request):
     log.msg('Request %s: ErrorPage: status %s, class %s' % (
         request._fluidDB_reqid, self.code, self.errorClassName))
     request.setHeader(buildHeader('Error-Class'), self.errorClassName)
     request.setHeader(buildHeader('Request-Id'), request._fluidDB_reqid)
     return TwistedErrorPage.render(self, request)
示例#9
0
 def __init__(self, message="Sorry, that resource already exists."):
     ErrorPage.__init__(self, http.CONFLICT, "Conflict", message)
示例#10
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.INTERNAL_SERVER_ERROR]):
     ErrorPage.__init__(self, http.INTERNAL_SERVER_ERROR,
                        http.RESPONSES[http.INTERNAL_SERVER_ERROR], message)
示例#11
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[FAILED_DEPENDENCY]):
     ErrorPage.__init__(self, FAILED_DEPENDENCY,
                        http.RESPONSES[FAILED_DEPENDENCY], message)
示例#12
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http._CONTINUE]):
     ErrorPage.__init__(self, http._CONTINUE,
                        http.RESPONSES[http._CONTINUE], message)
示例#13
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.CREATED]):
     ErrorPage.__init__(self, http.CREATED,
                        http.RESPONSES[http.CREATED], message)
示例#14
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.CONFLICT]):
     ErrorPage.__init__(self, http.CONFLICT,
                        http.RESPONSES[http.CONFLICT], message)
示例#15
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.BAD_REQUEST]):
     ErrorPage.__init__(self, http.BAD_REQUEST,
                        http.RESPONSES[http.BAD_REQUEST], message)
示例#16
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.BAD_GATEWAY]):
     ErrorPage.__init__(self, http.BAD_GATEWAY,
                        http.RESPONSES[http.BAD_GATEWAY], message)
示例#17
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[LOCKED]):
     ErrorPage.__init__(self, LOCKED,
                        http.RESPONSES[LOCKED], message)
示例#18
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.NO_CONTENT]):
     ErrorPage.__init__(self, http.NO_CONTENT,
                        http.RESPONSES[http.NO_CONTENT], message)
示例#19
0
 def __init__(self, status, brief, detail, errorClassName):
     self.errorClassName = errorClassName
     TwistedErrorPage.__init__(self, status, brief, detail)
示例#20
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.NOT_ALLOWED]):
     ErrorPage.__init__(self, http.NOT_ALLOWED,
                        http.RESPONSES[http.NOT_ALLOWED], message)
示例#21
0
 def __init__(self, message='Sorry, we could not find that resource.'):
     TwistedErrorPage.__init__(self, http.NOT_FOUND,
                               'No Such Resource', message)
示例#22
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.NOT_IMPLEMENTED]):
     ErrorPage.__init__(self, http.NOT_IMPLEMENTED,
                        http.RESPONSES[http.NOT_IMPLEMENTED], message)
示例#23
0
 def render(self, request):
     log.msg('Request %s: ErrorPage: status %s, class %s' %
             (request._fluidDB_reqid, self.code, self.errorClassName))
     request.setHeader(buildHeader('Error-Class'), self.errorClassName)
     request.setHeader(buildHeader('Request-Id'), request._fluidDB_reqid)
     return TwistedErrorPage.render(self, request)
示例#24
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[http.PRECONDITION_FAILED]):
     ErrorPage.__init__(self, http.PRECONDITION_FAILED,
                        http.RESPONSES[http.PRECONDITION_FAILED], message)
示例#25
0
 def _generateError(self, message):
     trace("server", message)
     return ErrorPage(404, "Error", message).render(self._request)
示例#26
0
文件: daverror.py 项目: steder/AkaDAV
 def __init__(self, message=http.RESPONSES[UNPROCESSIBLE_ENTITY]):
     ErrorPage.__init__(self, UNPROCESSIBLE_ENTITY,
                        http.RESPONSES[UNPROCESSIBLE_ENTITY], message)