[PR #204] feat: 添加 GitLab OAuth 认证功能 #204

Open
opened 2026-02-16 10:16:25 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/webapp-conversation/pull/204
Author: @myml
Created: 1/13/2026
Status: 🔄 Open

Base: mainHead: gitlab


📝 Commits (1)

  • 4e99c15 feat: 添加 GitLab OAuth 认证功能

📊 Changes

22 files changed (+1091 additions, -13 deletions)

View changed files

📝 .env.example (+6 -0)
app/api/auth/gitlab/callback/route.ts (+91 -0)
app/api/auth/gitlab/login/route.ts (+34 -0)
app/api/auth/logout/route.ts (+34 -0)
app/api/auth/user/route.ts (+67 -0)
📝 app/api/utils/common.ts (+52 -2)
app/auth-error/page.tsx (+115 -0)
app/components/auth/login-button.tsx (+94 -0)
📝 app/components/header.tsx (+14 -6)
📝 app/components/index.tsx (+36 -0)
config/auth.ts (+24 -0)
docs/gitlab-auth-setup.md (+86 -0)
hooks/use-auth.ts (+113 -0)
📝 i18n/i18next-config.ts (+12 -5)
i18n/lang/auth.en.ts (+39 -0)
i18n/lang/auth.es.ts (+39 -0)
i18n/lang/auth.fr.ts (+39 -0)
i18n/lang/auth.ja.ts (+39 -0)
i18n/lang/auth.vi.ts (+39 -0)
i18n/lang/auth.zh.ts (+39 -0)

...and 2 more files

📄 Description

实现完整的 GitLab OAuth 2.0 认证流程,包括登录、登出和用户状态管理功能。

  • 新增 /api/auth/gitlab/login 端点处理登录请求
  • 新增 /api/auth/gitlab/callback 端点处理 OAuth 回调
  • 新增 /api/auth/logout 端点处理登出
  • 新增 /api/auth/user 端点获取用户信息
  • 添加认证错误页面和登录按钮组件
  • 集成认证状态到应用主界面,支持认证保护
  • 添加多语言支持,覆盖中英日法西越六种语言
  • 提供详细的配置文档和故障排除指南

认证功能可通过环境变量 NEXT_PUBLIC_GITLAB_AUTH_ENABLED 控制启用/禁用,支持 GitLab.com 和自托管实例。


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/webapp-conversation/pull/204 **Author:** [@myml](https://github.com/myml) **Created:** 1/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `gitlab` --- ### 📝 Commits (1) - [`4e99c15`](https://github.com/langgenius/webapp-conversation/commit/4e99c158d398648097108856b7bc2f3b6044baa4) feat: 添加 GitLab OAuth 认证功能 ### 📊 Changes **22 files changed** (+1091 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+6 -0) ➕ `app/api/auth/gitlab/callback/route.ts` (+91 -0) ➕ `app/api/auth/gitlab/login/route.ts` (+34 -0) ➕ `app/api/auth/logout/route.ts` (+34 -0) ➕ `app/api/auth/user/route.ts` (+67 -0) 📝 `app/api/utils/common.ts` (+52 -2) ➕ `app/auth-error/page.tsx` (+115 -0) ➕ `app/components/auth/login-button.tsx` (+94 -0) 📝 `app/components/header.tsx` (+14 -6) 📝 `app/components/index.tsx` (+36 -0) ➕ `config/auth.ts` (+24 -0) ➕ `docs/gitlab-auth-setup.md` (+86 -0) ➕ `hooks/use-auth.ts` (+113 -0) 📝 `i18n/i18next-config.ts` (+12 -5) ➕ `i18n/lang/auth.en.ts` (+39 -0) ➕ `i18n/lang/auth.es.ts` (+39 -0) ➕ `i18n/lang/auth.fr.ts` (+39 -0) ➕ `i18n/lang/auth.ja.ts` (+39 -0) ➕ `i18n/lang/auth.vi.ts` (+39 -0) ➕ `i18n/lang/auth.zh.ts` (+39 -0) _...and 2 more files_ </details> ### 📄 Description 实现完整的 GitLab OAuth 2.0 认证流程,包括登录、登出和用户状态管理功能。 - 新增 `/api/auth/gitlab/login` 端点处理登录请求 - 新增 `/api/auth/gitlab/callback` 端点处理 OAuth 回调 - 新增 `/api/auth/logout` 端点处理登出 - 新增 `/api/auth/user` 端点获取用户信息 - 添加认证错误页面和登录按钮组件 - 集成认证状态到应用主界面,支持认证保护 - 添加多语言支持,覆盖中英日法西越六种语言 - 提供详细的配置文档和故障排除指南 认证功能可通过环境变量 `NEXT_PUBLIC_GITLAB_AUTH_ENABLED` 控制启用/禁用,支持 GitLab.com 和自托管实例。 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:16:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/webapp-conversation#204