fix: OA退出登录重定向修复 + SSO切换账号按钮 + 生产配置模板
- logout route 使用 request.url.origin 动态获取 base URL - 登录页添加「使用其他账号登录」按钮 - 新增 config/.env.prod 生产环境配置模板
This commit is contained in:
parent
34e685843e
commit
aa44104095
|
|
@ -0,0 +1,13 @@
|
|||
# OA 生产环境配置(模板)
|
||||
# 真实密钥由首次部署时生成,后续部署不覆盖
|
||||
LDAP_URL=ldap://lldap:3890
|
||||
LDAP_BASE_DN=dc=tlyq,dc=ai
|
||||
LDAP_ADMIN_DN=uid=admin,ou=people,dc=tlyq,dc=ai
|
||||
JWT_SECRET=__JWT_SECRET__
|
||||
COOKIE_DOMAIN=.tlyq.ai
|
||||
NODE_ENV=production
|
||||
NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
AUTHELIA_URL=https://sso.tlyq.ai
|
||||
OIDC_CLIENT_ID=oa-oidc
|
||||
OIDC_CLIENT_SECRET=__OIDC_CLIENT_SECRET__
|
||||
OIDC_REDIRECT_URI=https://oa.tlyq.ai/api/auth/callback
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { NextResponse } from 'next/server'
|
||||
import { cookies } from 'next/headers'
|
||||
|
||||
export async function POST() {
|
||||
export async function POST(request: Request) {
|
||||
const cookieStore = await cookies()
|
||||
const domain = process.env.COOKIE_DOMAIN || ''
|
||||
|
||||
|
|
@ -12,5 +12,7 @@ export async function POST() {
|
|||
|
||||
// Authelia 4.38 不支持 end_session_endpoint,直接跳转登录页
|
||||
// Authelia session 会在 cookie 过期后自动清除
|
||||
return NextResponse.redirect(new URL('/login', process.env.NEXT_PUBLIC_URL || 'http://127.0.0.1:6179'))
|
||||
// 从请求 URL 动态获取 base URL,避免硬编码 localhost
|
||||
const { origin } = new URL(request.url)
|
||||
return NextResponse.redirect(new URL('/login', origin))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ function LoginPageContent() {
|
|||
统一认证登录
|
||||
</button>
|
||||
<p className="text-center text-xs text-slate-400 mb-3">通过 SSO 统一身份认证</p>
|
||||
<p className="text-center mb-2">
|
||||
<button onClick={() => { window.location.href = '/api/auth/login/oidc?switch=1' }} className="text-xs text-slate-400 hover:text-slate-600 underline">
|
||||
使用其他账号登录
|
||||
</button>
|
||||
</p>
|
||||
<p className="text-center">
|
||||
<button onClick={() => setShowLdapForm(true)} className="text-xs text-slate-400 hover:text-slate-600 underline">
|
||||
使用 LDAP 直接登录
|
||||
|
|
|
|||
Loading…
Reference in New Issue