{"record":{"id":"28e7a4245f8c826d","repo":"ruvnet/RuView","slug":"authentication-required-28e7a4","errorCode":null,"errorMessage":"Authentication required","messagePattern":"Authentication required","errorType":"exception","errorClass":"AuthorizationError","httpStatus":403,"severity":"error","filePath":"archive/v1/src/middleware/auth.py","lineNumber":403,"sourceCode":"        user_roles = user_info.get(\"roles\", [])\n        \n        # Admin role has all permissions\n        if \"admin\" in user_roles:\n            return True\n        \n        # Check specific role\n        return required_role in user_roles\n    \n    def require_role(self, required_role: str):\n        \"\"\"Decorator to require specific role.\"\"\"\n        def decorator(func):\n            import functools\n            \n            @functools.wraps(func)\n            async def wrapper(request: Request, *args, **kwargs):\n                user_info = getattr(request.state, \"user\", None)\n                if not user_info:\n                    raise AuthorizationError(\"Authentication required\")\n                \n                if not self.check_permission(user_info, required_role):\n                    raise AuthorizationError(f\"Role '{required_role}' required\")\n                \n                return await func(request, *args, **kwargs)\n            \n            return wrapper\n        return decorator\n\n\n# Global authentication middleware instance\n_auth_middleware: Optional[AuthenticationMiddleware] = None\n\n\ndef get_auth_middleware(settings: Settings) -> AuthenticationMiddleware:\n    \"\"\"Get authentication middleware instance.\"\"\"\n    global _auth_middleware\n    if _auth_middleware is None:","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/middleware/auth.py#L385-L421","documentation":"Error \"Authentication required\" thrown in ruvnet/RuView.","triggerScenarios":"Thrown at archive/v1/src/middleware/auth.py:403 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}