def add_auth_on_not_found(self, security, security_definitions): """ Adds a 404 error handler to authenticate and only expose the 404 status if the security validation pass. """ logger.debug('Adding path not found authentication') not_found_error = AuthErrorHandler(self, werkzeug.exceptions.NotFound(), security=security, security_definitions=security_definitions) endpoint_name = "{name}_not_found".format(name=self.blueprint.name) self.blueprint.add_url_rule('/<path:invalid_path>', endpoint_name, not_found_error.function)
def add_auth_on_not_found(self, security, security_definitions): """ Adds a 404 error handler to authenticate and only expose the 404 status if the security validation pass. """ logger.debug('Adding path not found authentication') not_found_error = AuthErrorHandler( self, _HttpNotFoundError(), security=security, security_definitions=security_definitions) endpoint_name = "{}_not_found".format(self._api_name) self.subapp.router.add_route('*', '/{not_found_path}', not_found_error.function, name=endpoint_name)