Compare commits
No commits in common. "14c75a8942c66b3a50c0adcd3fcc43d97165da32" and "34e685843e76bb20a0b290814485c0e70b4c3c35" have entirely different histories.
14c75a8942
...
34e685843e
13
.env.example
13
.env.example
|
|
@ -1,14 +1,15 @@
|
||||||
# OA 门户环境变量(本地开发)
|
# OA 门户环境变量
|
||||||
LDAP_URL=ldap://localhost:3890
|
LDAP_URL=ldap://localhost:3890
|
||||||
LDAP_BASE_DN=dc=tlyq,dc=ai
|
LDAP_BASE_DN=dc=tlyq,dc=ai
|
||||||
LDAP_ADMIN_DN=uid=admin,ou=people,dc=tlyq,dc=ai
|
LDAP_ADMIN_DN=uid=admin,ou=people,dc=tlyq,dc=ai
|
||||||
JWT_SECRET=dev-jwt-secret-local
|
JWT_SECRET=change-me-same-across-all-sites
|
||||||
COOKIE_DOMAIN=
|
COOKIE_DOMAIN=
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
|
# ⚠️ 仅限本地开发环境(自签名证书),生产环境禁止设置此变量
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED=0
|
NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
|
|
||||||
# OIDC 配置
|
# OIDC 配置(SSO 统一认证)
|
||||||
AUTHELIA_URL=http://127.0.0.1:6180
|
AUTHELIA_URL=https://sso.tlyq.ai
|
||||||
OIDC_CLIENT_ID=oa-oidc
|
OIDC_CLIENT_ID=oa-oidc
|
||||||
OIDC_CLIENT_SECRET=<见 Authelia 配置>
|
OIDC_CLIENT_SECRET=change-me-to-hashed-secret
|
||||||
OIDC_REDIRECT_URI=http://127.0.0.1:6179/api/auth/callback
|
OIDC_REDIRECT_URI=http://localhost:6179/api/auth/callback
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
# 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 { NextResponse } from 'next/server'
|
||||||
import { cookies } from 'next/headers'
|
import { cookies } from 'next/headers'
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST() {
|
||||||
const cookieStore = await cookies()
|
const cookieStore = await cookies()
|
||||||
const domain = process.env.COOKIE_DOMAIN || ''
|
const domain = process.env.COOKIE_DOMAIN || ''
|
||||||
|
|
||||||
|
|
@ -12,7 +12,5 @@ export async function POST(request: Request) {
|
||||||
|
|
||||||
// Authelia 4.38 不支持 end_session_endpoint,直接跳转登录页
|
// Authelia 4.38 不支持 end_session_endpoint,直接跳转登录页
|
||||||
// Authelia session 会在 cookie 过期后自动清除
|
// Authelia session 会在 cookie 过期后自动清除
|
||||||
// 从请求 URL 动态获取 base URL,避免硬编码 localhost
|
return NextResponse.redirect(new URL('/login', process.env.NEXT_PUBLIC_URL || 'http://127.0.0.1:6179'))
|
||||||
const { origin } = new URL(request.url)
|
|
||||||
return NextResponse.redirect(new URL('/login', origin))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,6 @@ function LoginPageContent() {
|
||||||
统一认证登录
|
统一认证登录
|
||||||
</button>
|
</button>
|
||||||
<p className="text-center text-xs text-slate-400 mb-3">通过 SSO 统一身份认证</p>
|
<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">
|
<p className="text-center">
|
||||||
<button onClick={() => setShowLdapForm(true)} className="text-xs text-slate-400 hover:text-slate-600 underline">
|
<button onClick={() => setShowLdapForm(true)} className="text-xs text-slate-400 hover:text-slate-600 underline">
|
||||||
使用 LDAP 直接登录
|
使用 LDAP 直接登录
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue