Auth: migrate OAuth routes from /rest/v1/login to /rest/v1/auth/*

未关闭
#963 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@skypank-coder 已经在做这个了。

开始于 2026年7月9日。

评估

这个 Issue 还没有评估数据。

描述

Context

RFC merged in #876 (docs/rfc/user-auth-myopencre.md) proposes new auth routes at /auth/login, /auth/callback, /auth/logout. Existing Google OAuth already lives at:

  • GET /rest/v1/login
  • GET /rest/v1/callback
  • GET /rest/v1/logout
  • GET /rest/v1/user

Per maintainer review of #876, consolidate under the versioned API namespace:

Target routes:

  • GET /rest/v1/auth/login
  • GET /rest/v1/auth/callback
  • GET /rest/v1/auth/logout
  • GET /rest/v1/auth/user (or keep /rest/v1/user — decide during implementation)

Requirements

  • Add /rest/v1/auth/* routes implementing the RFC TODO 1 session contract (session['user_id'], redirect on missing session)
  • Keep /rest/v1/login, /rest/v1/callback, /rest/v1/logout as temporary aliases with deprecation headers or redirect to /rest/v1/auth/*
  • Update frontend (useUser, Header) and any docs referencing old paths
  • Update login_required to redirect to /rest/v1/auth/login?next=<url> (not 401 for browser flows)
  • Consider separate behavior for API clients (Accept: application/json → 401 vs browser → 302)

Related

  • RFC: docs/rfc/user-auth-myopencre.md TODO 1
  • #586 (MyOpenCRE online)
  • #943 (frontend auth UX)
  • #949 (capabilities API)

Acceptance criteria

  • New routes work end-to-end with Google OAuth
  • Old routes redirect or alias without breaking existing bookmarks
  • Tests cover both old aliases and new canonical paths during migration window
主要语言
Python
星标
210
派生
167
平均合并
4 天 12 小时
30 天内合并 PR
28

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OWASP/OpenCRE 的其他 Issue

查看 OWASP/OpenCRE 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。