abinazebinoy commited on
Commit
0ca8d0b
·
unverified ·
2 Parent(s): bca13d11f5760a

Merge pull request #161 from abinaze/fix/frontend-authdup

Browse files
Files changed (1) hide show
  1. backend/core/auth.py +0 -32
backend/core/auth.py CHANGED
@@ -82,35 +82,3 @@ def require_role_for_method(request: Request, authorization: Optional[str] = Hea
82
  detail=f"Role '{entry.get('role')}' is not permitted to {request.method} this endpoint.",
83
  )
84
  return entry
85
-
86
-
87
- def require_analyst_or_demo(authorization: Optional[str] = Header(None)) -> dict:
88
- """FastAPI dependency: require a real analyst/admin key, OR the public
89
- demo token (F-1). The demo token is opt-in and fail-closed: it is only
90
- accepted when settings.PUBLIC_DEMO_KEY is non-empty, so a deployment
91
- that never sets it behaves exactly like require_analyst. Still subject
92
- to normal per-IP rate limiting like any other request.
93
- """
94
- from backend.core.config import settings
95
- if (
96
- settings.PUBLIC_DEMO_KEY
97
- and authorization == f"Bearer {settings.PUBLIC_DEMO_KEY}"
98
- ):
99
- return {"key_id": "public-demo", "name": "Public Demo", "role": "analyst"}
100
- return require_analyst(authorization)
101
-
102
-
103
- def require_analyst_or_demo(authorization: Optional[str] = Header(None)) -> dict:
104
- """FastAPI dependency: require a real analyst/admin key, OR the public
105
- demo token (F-1). The demo token is opt-in and fail-closed: it is only
106
- accepted when settings.PUBLIC_DEMO_KEY is non-empty, so a deployment
107
- that never sets it behaves exactly like require_analyst. Still subject
108
- to normal per-IP rate limiting like any other request.
109
- """
110
- from backend.core.config import settings
111
- if (
112
- settings.PUBLIC_DEMO_KEY
113
- and authorization == f"Bearer {settings.PUBLIC_DEMO_KEY}"
114
- ):
115
- return {"key_id": "public-demo", "name": "Public Demo", "role": "analyst"}
116
- return require_analyst(authorization)
 
82
  detail=f"Role '{entry.get('role')}' is not permitted to {request.method} this endpoint.",
83
  )
84
  return entry