Beispiel #1
0
    def __call__(self, environ, start_response):
        path_args = environ[ARGS_KEY]

        try:
            rfc7662 = _verify_user(environ)
        except MKException as exc:
            return problem(
                status=401,
                title=str(exc),
            )(environ, start_response)

        with set_user_context(rfc7662["sub"], rfc7662):
            wsgi_app = self.func(ParameterDict(path_args))
            return wsgi_app(environ, start_response)
Beispiel #2
0
    def __call__(self, environ: WSGIEnvironment,
                 start_response: StartResponse) -> WSGIResponse:
        path_args = environ[ARGS_KEY]

        try:
            rfc7662 = _verify_user(environ, datetime.now())
        except MKException as exc:
            return problem(
                status=401,
                title=str(exc),
            )(environ, start_response)

        with set_user_context(rfc7662["sub"], rfc7662):
            wsgi_app = self.endpoint.wrapped(ParameterDict(path_args))
            return wsgi_app(environ, start_response)