fix(identity): 支持平台用户显式登录 AI Gateway
修复多租户身份配置将所有人类登录都强制解释为租户上下文的问题。Web 现在提供平台与租户两个受控入口,API 严格绑定 context_type、tid、issuer、application 和 subject,并为平台用户建立独立本地投影与可刷新会话。\n\n风险:新增会话身份列保持旧会话可读,新会话一律使用严格约束;未改变租户数据隔离和 API Key 行为。\n\n验证:Go 全量测试与 go vet 通过;PostgreSQL 平台投影、会话和安全事件集成测试通过;前端 lint、141 项测试与生产 build 通过;OpenAPI 生成和迁移安全测试通过。
This commit is contained in:
@@ -2,6 +2,7 @@ import type { FormEvent } from 'react';
|
||||
import { LogIn, UserPlus } from 'lucide-react';
|
||||
import { Button, Card, CardContent, CardHeader, CardTitle, Input, Label, PasswordInput, Tabs } from './ui';
|
||||
import type { AuthMode, LoadState, LoginForm, RegisterForm } from '../types';
|
||||
import type { OIDCContextType } from '../lib/oidc';
|
||||
|
||||
const tabs = [
|
||||
{ value: 'login', label: '账号登录' },
|
||||
@@ -23,7 +24,8 @@ export function AuthPanel(props: {
|
||||
onSubmitLogin: (event: FormEvent<HTMLFormElement>) => void;
|
||||
onSubmitRegister: (event: FormEvent<HTMLFormElement>) => void;
|
||||
oidcEnabled: boolean;
|
||||
onOIDCLogin: () => void;
|
||||
oidcContextTypes: readonly OIDCContextType[];
|
||||
onOIDCLogin: (contextType: OIDCContextType) => void;
|
||||
}) {
|
||||
return (
|
||||
<section className="authShell" aria-label="登录">
|
||||
@@ -36,10 +38,28 @@ export function AuthPanel(props: {
|
||||
</CardHeader>
|
||||
<CardContent className="authContent">
|
||||
{props.oidcEnabled ? (
|
||||
<Button type="button" disabled={props.state === 'loading'} onClick={props.onOIDCLogin}>
|
||||
<LogIn size={15} />
|
||||
使用统一认证中心登录
|
||||
</Button>
|
||||
<div className="formGrid">
|
||||
{props.oidcContextTypes.includes('platform') && (
|
||||
<Button
|
||||
type="button"
|
||||
disabled={props.state === 'loading'}
|
||||
onClick={() => props.onOIDCLogin('platform')}
|
||||
>
|
||||
<LogIn size={15} />
|
||||
使用平台账号登录
|
||||
</Button>
|
||||
)}
|
||||
{props.oidcContextTypes.includes('tenant') && (
|
||||
<Button
|
||||
type="button"
|
||||
disabled={props.state === 'loading'}
|
||||
onClick={() => props.onOIDCLogin('tenant')}
|
||||
>
|
||||
<LogIn size={15} />
|
||||
使用租户账号登录
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Tabs value={props.authMode} tabs={tabs} onValueChange={props.onAuthModeChange} />
|
||||
|
||||
Reference in New Issue
Block a user