Implement BFF OAuth2 Proxy
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- azure, fastapi, nginx, python, react, redis, typescript
- Lĩnh vực
- api, authentication, backend, devops, frontend, infrastructure, security
Hướng nghiên cứu
Bắt đầu bằng cách xác định các điểm vào để triển khai hoặc cấu hình Nginx, oauth2-proxy và FastAPI, sau đó lần theo các route /oauth2/* và /api/*. Xem xét cách các token Microsoft Entra ID và các session được Redis hỗ trợ được kỳ vọng sẽ hoạt động. Công việc được xem là hoàn tất khi định tuyến có xác thực, xử lý session an toàn, các header token và việc xác thực JWT của FastAPI khớp với các yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe Problem
The application requires secure authentication for the SPA frontend to communicate with the FastAPI backend API. Direct OAuth2 flows from the browser (implicit flow or authorization code with PKCE stored in browser) expose tokens to XSS attacks and require complex token management in the frontend. Without a Backend-for-Frontend (BFF) pattern, the frontend must handle token refresh, storage, and secure transmission, increasing attack surface and complexity.
Suggest Solution
Implement a BFF OAuth2 proxy using oauth2-proxy with the following architecture:
- Deploy oauth2-proxy as an intermediary between the SPA and backend API
- Configure OIDC authentication with Microsoft Entra ID (Azure AD)
- Use PKCE (
code_challenge_method: S256) for secure authorization code flow - Enable Redis-backed session storage for horizontal scalability
- Configure Nginx reverse proxy with
auth_requestdirective- Route
/oauth2/*paths directly to oauth2-proxy - Enforce authentication on
/api/*routes (return 401 if unauthenticated) - Redirect unauthenticated users to sign-in for all other routes
- Route
- Token injection via headers
- Inject
Authorization: Bearer <id_token>header for API requests - Forward
X-Auth-Request-Access-Tokenfor additional validation
- Inject
- Secure cookie configuration
cookie_secure: true,cookie_httponly: true,cookie_samesite: lax- 15-minute token refresh interval, 1-hour session expiry
- CSRF protection with per-request tokens
- Backend JWT validation in FastAPI
- Validate tokens against Azure AD JWKS endpoint
- Extract user claims (oid, name, email, roles) for authorization
Additional Details
- Ngôn ngữ chính
- TypeScript
- Star
- 106
- Fork
- 15
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của equinor/template-fastapi-react
-
Follow-ups from #679 reviewĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
equinor/template-fastapi-react#702 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Investigate switching to kubbĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
equinor/template-fastapi-react#701 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
equinor/template-fastapi-react#438 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
equinor/template-fastapi-react#397 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update CI workflow (tests.yaml) to reflect pre-commitCó thể đã có người làm @mariuswinger đã nhận 1612 ngày trước. Đang mởtype: :bulb: feature
equinor/template-fastapi-react#41 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của equinor/template-fastapi-react
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
justyns/silverbullet-ai#199 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
comet-ml/opik#9877 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: board bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
lingdojo/kana-dojo#34857 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày