Ejemplo n.º 1
0
    def __call__(self, environ, start_response):
        '''Invoke the Controller'''
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # we add a unique request id to the request enviroment
        # so we can trace individual requests in the logging

        environ['REQUEST_ID'] = str(uuid4())
        environ['REQUEST_START_TIMESTAMP'] = datetime.now()

        with request_context_safety():

            try:
                self._parse_request_params(request)
            except UnicodeDecodeError as exx:
                # we supress Exception here as it will be handled in the
                # controller which will return corresponding response
                log.warning('Failed to access request parameters: %r' % exx)

            self.create_context(request, environ)

            try:
                try:
                    user_desc = getUserFromRequest(request)
                    self.base_auth_user = user_desc.get('login', '')
                except UnicodeDecodeError as exx:
                    # we supress Exception here as it will be handled in the
                    # controller which will return corresponding response
                    log.warning('Failed to identify user due to %r' % exx)

                ret = WSGIController.__call__(self, environ, start_response)
                log.debug("Request reply: %r", ret)

            finally:
                meta.Session.remove()
                # free the lock on the scurityPovider if any
                if self.sep:
                    self.sep.dropSecurityModule()
                closeResolvers()

                # hint for the garbage collector to make the dishes
                data_objects = [
                    "resolvers_loaded", "resolver_clazzes", "linotpConfig",
                    "audit", "hsm"
                ]
                for data_obj in data_objects:
                    if hasattr(c, data_obj):
                        data = getattr(c, data_obj)
                        del data

                log_request_timedelta(log)

            return ret
Ejemplo n.º 2
0
    def __call__(self, environ, start_response):
        '''Invoke the Controller'''
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        path = ""

        with request_context_safety():

            self.create_context(request)

            try:
                if environ:
                    path = environ.get("PATH_INFO", "") or ""

                try:
                    user_desc = getUserFromRequest(request)
                    self.base_auth_user = user_desc.get('login', '')
                except UnicodeDecodeError as exx:
                    # we supress Exception here as it will be handled in the
                    # controller which will return corresponding response
                    log.info('Failed to identify user due to %r' % exx)

                log.debug("request %r" % path)
                ret = WSGIController.__call__(self, environ, start_response)
                log.debug("reply %r" % ret)

            finally:
                meta.Session.remove()
                # free the lock on the scurityPovider if any
                if self.sep:
                    self.sep.dropSecurityModule()
                closeResolvers()

                # hint for the garbage collector to make the dishes
                data_objects = [
                    "resolvers_loaded", "resolver_types", "resolver_clazzes",
                    "linotpConfig", "audit", "hsm"
                ]
                for data_obj in data_objects:
                    if hasattr(c, data_obj):
                        data = getattr(c, data_obj)
                        del data

                log.debug("request %r done!" % path)

            return ret
Ejemplo n.º 3
0
    def __call__(self, environ, start_response):
        '''Invoke the Controller'''
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        path = ""

        with request_context_safety():

            self.create_context(request)

            try:
                if environ:
                    path = environ.get("PATH_INFO", "") or ""

                try:
                    user_desc = getUserFromRequest(request)
                    self.base_auth_user = user_desc.get('login', '')
                except UnicodeDecodeError as exx:
                    # we supress Exception here as it will be handled in the
                    # controller which will return corresponding response
                    log.info('Failed to identify user due to %r' % exx)

                log.debug("request %r" % path)
                ret = WSGIController.__call__(self, environ, start_response)
                log.debug("reply %r" % ret)

            finally:
                meta.Session.remove()
                # free the lock on the scurityPovider if any
                if self.sep:
                    self.sep.dropSecurityModule()
                closeResolvers()

                # hint for the garbage collector to make the dishes
                data_objects = ["resolvers_loaded", "resolver_types",
                                "resolver_clazzes", "linotpConfig", "audit", "hsm"]
                for data_obj in data_objects:
                    if hasattr(c, data_obj):
                        data = getattr(c, data_obj)
                        del data

                log.debug("request %r done!" % path)

            return ret
Ejemplo n.º 4
0
    def __call__(self, environ, start_response):
        '''Invoke the Controller'''
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        path = ""
        glo = getGlobalObject()
        sep = glo.security_provider

        try:
            hsm = sep.getSecurityModule()
            c.hsm = hsm

            if environ:
                path = environ.get("PATH_INFO", "") or ""

            log.debug("request %r" % path)
            ret = WSGIController.__call__(self, environ, start_response)
            log.debug("reply %r" % ret)

        finally:
            meta.Session.remove()
            ## free the lock on the scurityPovider if any
            sep.dropSecurityModule()
            closeResolvers()

            ## hint for the garbage collector to make the dishes
            data_objects = [
                "resolvers_loaded", "resolver_types", "resolver_clazzes",
                "linotpConfig", "audit", "hsm"
            ]
            for data_obj in data_objects:
                if hasattr(c, data_obj):
                    data = getattr(c, data_obj)
                    del data

            log.debug("request %r done!" % path)

        return ret
Ejemplo n.º 5
0
    def __call__(self, environ, start_response):
        '''Invoke the Controller'''
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        path = ""
        glo = getGlobalObject()
        sep = glo.security_provider

        try:
            hsm = sep.getSecurityModule()
            c.hsm = hsm

            if environ:
                path = environ.get("PATH_INFO", "") or ""

            log.debug("request %r" % path)
            ret = WSGIController.__call__(self, environ, start_response)
            log.debug("reply %r" % ret)

        finally:
            meta.Session.remove()
            ## free the lock on the scurityPovider if any
            sep.dropSecurityModule()
            closeResolvers()


            ## hint for the garbage collector to make the dishes
            data_objects = ["resolvers_loaded", "resolver_types",
                            "resolver_clazzes", "linotpConfig", "audit", "hsm"]
            for data_obj in data_objects:
                if hasattr(c, data_obj):
                    data = getattr(c, data_obj)
                    del data

            log.debug("request %r done!" % path)

        return ret