@svadmin/ui 0.129.0 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.css +403 -0
- package/dist/app.theme.css +403 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AccessRevocationMatrix.svelte +425 -0
- package/dist/components/AccessRevocationMatrix.svelte.d.ts +27 -0
- package/dist/components/AudioVisualInspector.svelte +458 -0
- package/dist/components/AudioVisualInspector.svelte.d.ts +53 -0
- package/dist/components/AuditSnapshotCapture.svelte +328 -0
- package/dist/components/AuditSnapshotCapture.svelte.d.ts +28 -0
- package/dist/components/CannedResponsePicker.svelte +257 -0
- package/dist/components/CannedResponsePicker.svelte.d.ts +22 -0
- package/dist/components/ContentModerationCenter.svelte +166 -0
- package/dist/components/ContentModerationCenter.svelte.d.ts +11 -0
- package/dist/components/ContractClauseDiffViewer.svelte +566 -0
- package/dist/components/ContractClauseDiffViewer.svelte.d.ts +53 -0
- package/dist/components/DataImportPipeline.svelte +577 -0
- package/dist/components/DataImportPipeline.svelte.d.ts +35 -0
- package/dist/components/DataRetentionPolicyEditor.svelte +455 -0
- package/dist/components/DataRetentionPolicyEditor.svelte.d.ts +10 -0
- package/dist/components/ElectronicSealInspector.svelte +450 -0
- package/dist/components/ElectronicSealInspector.svelte.d.ts +72 -0
- package/dist/components/EmployeeOffboardingAuditor.svelte +405 -0
- package/dist/components/EmployeeOffboardingAuditor.svelte.d.ts +39 -0
- package/dist/components/FeatureFlagStudio.svelte +583 -0
- package/dist/components/FeatureFlagStudio.svelte.d.ts +12 -0
- package/dist/components/FieldMappingBuilder.svelte +393 -0
- package/dist/components/FieldMappingBuilder.svelte.d.ts +39 -0
- package/dist/components/GatewayRouteEditor.svelte +493 -0
- package/dist/components/GatewayRouteEditor.svelte.d.ts +34 -0
- package/dist/components/HotkeysHelpModal.svelte +286 -0
- package/dist/components/HotkeysHelpModal.svelte.d.ts +21 -0
- package/dist/components/I18nStudio.svelte +635 -0
- package/dist/components/I18nStudio.svelte.d.ts +23 -0
- package/dist/components/IpAccessRuleEditor.svelte +290 -0
- package/dist/components/IpAccessRuleEditor.svelte.d.ts +19 -0
- package/dist/components/IpWhitelistDrawer.svelte +94 -0
- package/dist/components/IpWhitelistDrawer.svelte.d.ts +10 -0
- package/dist/components/MediaAuthenticityAuditCard.svelte +357 -0
- package/dist/components/MediaAuthenticityAuditCard.svelte.d.ts +64 -0
- package/dist/components/MediaGallery.svelte +575 -0
- package/dist/components/MediaGallery.svelte.d.ts +34 -0
- package/dist/components/NotificationCenter.svelte +20 -1
- package/dist/components/NotificationCenter.svelte.d.ts +2 -0
- package/dist/components/NotificationDrawer.svelte +242 -0
- package/dist/components/NotificationDrawer.svelte.d.ts +40 -0
- package/dist/components/PrintDocument.svelte +95 -0
- package/dist/components/PrintDocument.svelte.d.ts +10 -0
- package/dist/components/PrintPreviewModal.svelte +52 -0
- package/dist/components/PrintPreviewModal.svelte.d.ts +11 -0
- package/dist/components/PrintTemplateDesigner.svelte +280 -0
- package/dist/components/PrintTemplateDesigner.svelte.d.ts +11 -0
- package/dist/components/RateLimitPolicyPanel.svelte +369 -0
- package/dist/components/RateLimitPolicyPanel.svelte.d.ts +29 -0
- package/dist/components/ResizableSplitter.svelte +246 -0
- package/dist/components/ResizableSplitter.svelte.d.ts +18 -0
- package/dist/components/SensitiveWordAuditor.svelte +368 -0
- package/dist/components/SensitiveWordAuditor.svelte.d.ts +9 -0
- package/dist/components/ServiceDeskTicketCard.svelte +297 -0
- package/dist/components/ServiceDeskTicketCard.svelte.d.ts +52 -0
- package/dist/components/ShiftScheduler.svelte +490 -0
- package/dist/components/ShiftScheduler.svelte.d.ts +50 -0
- package/dist/components/SslCertificateMonitorCard.svelte +309 -0
- package/dist/components/SslCertificateMonitorCard.svelte.d.ts +30 -0
- package/dist/components/SsoConnectionStudio.svelte +784 -0
- package/dist/components/SsoConnectionStudio.svelte.d.ts +44 -0
- package/dist/components/SsoSpMetadataPanel.svelte +44 -0
- package/dist/components/SsoSpMetadataPanel.svelte.d.ts +8 -0
- package/dist/components/StepUpAuthModal.svelte +448 -0
- package/dist/components/StepUpAuthModal.svelte.d.ts +26 -0
- package/dist/components/TrafficTopologyInspector.svelte +361 -0
- package/dist/components/TrafficTopologyInspector.svelte.d.ts +43 -0
- package/dist/components/ip-access-rules.d.ts +24 -0
- package/dist/components/ip-access-rules.js +110 -0
- package/dist/components/moderation-utils.d.ts +45 -0
- package/dist/components/moderation-utils.js +74 -0
- package/dist/components/print-document.d.ts +3 -0
- package/dist/components/print-document.js +65 -0
- package/dist/components/print-utils.d.ts +44 -0
- package/dist/components/print-utils.js +68 -0
- package/dist/components/retention-utils.d.ts +31 -0
- package/dist/components/retention-utils.js +38 -0
- package/dist/components/sso-connection-presets.d.ts +2 -0
- package/dist/components/sso-connection-presets.js +59 -0
- package/dist/components/ui/sheet/sheet.svelte +3 -1
- package/dist/components/ui/sheet/sheet.svelte.d.ts +1 -0
- package/dist/components/useFeatureFlag.d.svelte.ts +1 -0
- package/dist/components/useFeatureFlag.svelte.d.ts +45 -0
- package/dist/components/useFeatureFlag.svelte.js +94 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +53 -0
- package/package.json +5 -4
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import { defaultSsoConnections } from './sso-connection-presets.js';
|
|
4
|
+
import SsoSpMetadataPanel from './SsoSpMetadataPanel.svelte';
|
|
5
|
+
|
|
6
|
+
export type SsoProtocol = 'saml' | 'oidc' | 'oauth2' | 'feishu' | 'dingtalk' | 'wecom';
|
|
7
|
+
export type SsoStatus = 'active' | 'inactive' | 'testing';
|
|
8
|
+
|
|
9
|
+
export interface SsoClaimMapping {
|
|
10
|
+
remoteClaim: string;
|
|
11
|
+
localField: string;
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SsoConnection {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
protocol: SsoProtocol;
|
|
19
|
+
status: SsoStatus;
|
|
20
|
+
domains: string[];
|
|
21
|
+
isDefault?: boolean;
|
|
22
|
+
// SAML
|
|
23
|
+
entityId?: string;
|
|
24
|
+
ssoUrl?: string;
|
|
25
|
+
certificate?: string;
|
|
26
|
+
// OIDC / OAuth2
|
|
27
|
+
clientId?: string;
|
|
28
|
+
clientSecret?: string;
|
|
29
|
+
discoveryUrl?: string;
|
|
30
|
+
scopes?: string[];
|
|
31
|
+
// Enterprise Office Suites
|
|
32
|
+
appId?: string;
|
|
33
|
+
appSecret?: string;
|
|
34
|
+
corpId?: string;
|
|
35
|
+
// Claim mapping
|
|
36
|
+
claimMappings?: SsoClaimMapping[];
|
|
37
|
+
lastTestedAt?: string;
|
|
38
|
+
testStatus?: 'success' | 'failed' | 'untested';
|
|
39
|
+
testMessage?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SsoConnectionStudioProps {
|
|
43
|
+
connections?: SsoConnection[];
|
|
44
|
+
class?: string;
|
|
45
|
+
spEntityId?: string;
|
|
46
|
+
spAcsUrl?: string;
|
|
47
|
+
onSave?: (conn: SsoConnection) => void;
|
|
48
|
+
onDelete?: (id: string) => void;
|
|
49
|
+
onTest?: (conn: SsoConnection) => Promise<{ success: boolean; message: string }>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
connections = [],
|
|
54
|
+
class: className = '',
|
|
55
|
+
spEntityId = 'https://auth.svadmin.internal/saml/metadata',
|
|
56
|
+
spAcsUrl = 'https://auth.svadmin.internal/saml/acs',
|
|
57
|
+
onSave,
|
|
58
|
+
onDelete,
|
|
59
|
+
onTest,
|
|
60
|
+
}: SsoConnectionStudioProps = $props();
|
|
61
|
+
|
|
62
|
+
// Internal reactive items
|
|
63
|
+
let connList = $state<SsoConnection[]>(untrack(() => connections.length > 0
|
|
64
|
+
? connections.map(c => ({ ...c, domains: [...c.domains], claimMappings: c.claimMappings ? [...c.claimMappings] : [] }))
|
|
65
|
+
: structuredClone(defaultSsoConnections)))
|
|
66
|
+
|
|
67
|
+
// Filters & Search
|
|
68
|
+
let searchQuery = $state('');
|
|
69
|
+
let protocolFilter = $state<'ALL' | SsoProtocol>('ALL');
|
|
70
|
+
let statusFilter = $state<'ALL' | SsoStatus>('ALL');
|
|
71
|
+
let showSpMetadata = $state(false);
|
|
72
|
+
let copiedNotification = $state<string | null>(null);
|
|
73
|
+
|
|
74
|
+
// Edit / Add modal
|
|
75
|
+
let isEditing = $state(false);
|
|
76
|
+
let editId = $state('');
|
|
77
|
+
let editName = $state('');
|
|
78
|
+
let editProtocol = $state<SsoProtocol>('saml');
|
|
79
|
+
let editStatus = $state<SsoStatus>('active');
|
|
80
|
+
let editDomains = $state('');
|
|
81
|
+
let editIsDefault = $state(false);
|
|
82
|
+
// SAML fields
|
|
83
|
+
let editEntityId = $state('');
|
|
84
|
+
let editSsoUrl = $state('');
|
|
85
|
+
let editCert = $state('');
|
|
86
|
+
// OIDC fields
|
|
87
|
+
let editClientId = $state('');
|
|
88
|
+
let editClientSecret = $state('');
|
|
89
|
+
let editDiscoveryUrl = $state('');
|
|
90
|
+
let editScopes = $state('openid,profile,email');
|
|
91
|
+
// Enterprise Suite fields
|
|
92
|
+
let editAppId = $state('');
|
|
93
|
+
let editAppSecret = $state('');
|
|
94
|
+
let editCorpId = $state('');
|
|
95
|
+
// Claims
|
|
96
|
+
let editClaimMappings = $state<SsoClaimMapping[]>([]);
|
|
97
|
+
|
|
98
|
+
// Testing feedback
|
|
99
|
+
let testingConnectionId = $state<string | null>(null);
|
|
100
|
+
|
|
101
|
+
const filteredConnections = $derived.by(() => {
|
|
102
|
+
return connList.filter((conn) => {
|
|
103
|
+
if (protocolFilter !== 'ALL' && conn.protocol !== protocolFilter) return false;
|
|
104
|
+
if (statusFilter !== 'ALL' && conn.status !== statusFilter) return false;
|
|
105
|
+
if (searchQuery.trim()) {
|
|
106
|
+
const q = searchQuery.toLowerCase();
|
|
107
|
+
const matchesName = conn.name.toLowerCase().includes(q);
|
|
108
|
+
const matchesDomains = conn.domains.some(d => d.toLowerCase().includes(q));
|
|
109
|
+
const matchesId = conn.id.toLowerCase().includes(q);
|
|
110
|
+
if (!matchesName && !matchesDomains && !matchesId) return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Computed overview metrics
|
|
117
|
+
const activeCount = $derived(connList.filter(c => c.status === 'active').length);
|
|
118
|
+
const totalDomains = $derived(new Set(connList.flatMap(c => c.domains)).size);
|
|
119
|
+
|
|
120
|
+
function copyText(text: string, label: string) {
|
|
121
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
122
|
+
navigator.clipboard.writeText(text);
|
|
123
|
+
copiedNotification = label;
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
copiedNotification = null;
|
|
126
|
+
}, 2000);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function openCreateDialog() {
|
|
131
|
+
editId = `conn-${Date.now()}`;
|
|
132
|
+
editName = '';
|
|
133
|
+
editProtocol = 'saml';
|
|
134
|
+
editStatus = 'active';
|
|
135
|
+
editDomains = '';
|
|
136
|
+
editIsDefault = connList.length === 0;
|
|
137
|
+
editEntityId = '';
|
|
138
|
+
editSsoUrl = '';
|
|
139
|
+
editCert = '';
|
|
140
|
+
editClientId = '';
|
|
141
|
+
editClientSecret = '';
|
|
142
|
+
editDiscoveryUrl = '';
|
|
143
|
+
editScopes = 'openid,profile,email';
|
|
144
|
+
editAppId = '';
|
|
145
|
+
editAppSecret = '';
|
|
146
|
+
editCorpId = '';
|
|
147
|
+
editClaimMappings = [
|
|
148
|
+
{ remoteClaim: 'email', localField: 'email' },
|
|
149
|
+
{ remoteClaim: 'name', localField: 'display_name' },
|
|
150
|
+
];
|
|
151
|
+
isEditing = true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function openEditDialog(conn: SsoConnection) {
|
|
155
|
+
editId = conn.id;
|
|
156
|
+
editName = conn.name;
|
|
157
|
+
editProtocol = conn.protocol;
|
|
158
|
+
editStatus = conn.status;
|
|
159
|
+
editDomains = conn.domains.join(', ');
|
|
160
|
+
editIsDefault = Boolean(conn.isDefault);
|
|
161
|
+
editEntityId = conn.entityId || '';
|
|
162
|
+
editSsoUrl = conn.ssoUrl || '';
|
|
163
|
+
editCert = conn.certificate || '';
|
|
164
|
+
editClientId = conn.clientId || '';
|
|
165
|
+
editClientSecret = conn.clientSecret || '';
|
|
166
|
+
editDiscoveryUrl = conn.discoveryUrl || '';
|
|
167
|
+
editScopes = conn.scopes?.join(',') || 'openid,profile,email';
|
|
168
|
+
editAppId = conn.appId || '';
|
|
169
|
+
editAppSecret = conn.appSecret || '';
|
|
170
|
+
editCorpId = conn.corpId || '';
|
|
171
|
+
editClaimMappings = conn.claimMappings ? conn.claimMappings.map(m => ({ ...m })) : [];
|
|
172
|
+
isEditing = true;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function addClaimMapping() {
|
|
176
|
+
editClaimMappings = [...editClaimMappings, { remoteClaim: '', localField: '' }];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function removeClaimMapping(index: number) {
|
|
180
|
+
editClaimMappings = editClaimMappings.filter((_, i) => i !== index);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function saveConnection() {
|
|
184
|
+
if (!editName.trim()) return;
|
|
185
|
+
|
|
186
|
+
const domains = editDomains
|
|
187
|
+
.split(',')
|
|
188
|
+
.map(d => d.trim().toLowerCase())
|
|
189
|
+
.filter(Boolean);
|
|
190
|
+
|
|
191
|
+
const updated: SsoConnection = {
|
|
192
|
+
id: editId,
|
|
193
|
+
name: editName.trim(),
|
|
194
|
+
protocol: editProtocol,
|
|
195
|
+
status: editStatus,
|
|
196
|
+
domains,
|
|
197
|
+
isDefault: editIsDefault,
|
|
198
|
+
claimMappings: editClaimMappings.filter(m => m.remoteClaim && m.localField),
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
if (editProtocol === 'saml') {
|
|
202
|
+
updated.entityId = editEntityId.trim();
|
|
203
|
+
updated.ssoUrl = editSsoUrl.trim();
|
|
204
|
+
updated.certificate = editCert.trim();
|
|
205
|
+
} else if (editProtocol === 'oidc' || editProtocol === 'oauth2') {
|
|
206
|
+
updated.clientId = editClientId.trim();
|
|
207
|
+
updated.clientSecret = editClientSecret.trim();
|
|
208
|
+
updated.discoveryUrl = editDiscoveryUrl.trim();
|
|
209
|
+
updated.scopes = editScopes.split(',').map(s => s.trim()).filter(Boolean);
|
|
210
|
+
} else {
|
|
211
|
+
updated.appId = editAppId.trim();
|
|
212
|
+
updated.appSecret = editAppSecret.trim();
|
|
213
|
+
updated.corpId = editCorpId.trim();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const existingIndex = connList.findIndex(c => c.id === editId);
|
|
217
|
+
if (existingIndex >= 0) {
|
|
218
|
+
connList[existingIndex] = updated;
|
|
219
|
+
} else {
|
|
220
|
+
connList = [...connList, updated];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Handle isDefault exclusivity
|
|
224
|
+
if (updated.isDefault) {
|
|
225
|
+
for (const c of connList) {
|
|
226
|
+
if (c.id !== updated.id) c.isDefault = false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
onSave?.(updated);
|
|
231
|
+
isEditing = false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function deleteConnection(id: string) {
|
|
235
|
+
connList = connList.filter(c => c.id !== id);
|
|
236
|
+
onDelete?.(id);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function toggleStatus(conn: SsoConnection) {
|
|
240
|
+
const nextStatus = conn.status === 'active' ? 'inactive' : 'active';
|
|
241
|
+
conn.status = nextStatus;
|
|
242
|
+
onSave?.({ ...conn });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function setDefault(conn: SsoConnection) {
|
|
246
|
+
for (const c of connList) {
|
|
247
|
+
c.isDefault = c.id === conn.id;
|
|
248
|
+
}
|
|
249
|
+
onSave?.({ ...conn, isDefault: true });
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async function testConnection(conn: SsoConnection) {
|
|
253
|
+
testingConnectionId = conn.id;
|
|
254
|
+
try {
|
|
255
|
+
if (onTest) {
|
|
256
|
+
const res = await onTest(conn);
|
|
257
|
+
conn.testStatus = res.success ? 'success' : 'failed';
|
|
258
|
+
conn.testMessage = res.message;
|
|
259
|
+
} else {
|
|
260
|
+
// Built-in synthetic validation
|
|
261
|
+
await new Promise(r => setTimeout(r, 600));
|
|
262
|
+
let pass = false;
|
|
263
|
+
let msg = '';
|
|
264
|
+
if (conn.protocol === 'saml') {
|
|
265
|
+
pass = Boolean(conn.ssoUrl && conn.ssoUrl.startsWith('https://') && conn.entityId);
|
|
266
|
+
msg = pass ? 'SAML Endpoints verified. TLS & Certificate valid.' : 'Failed: SSO URL must be https:// and Entity ID required.';
|
|
267
|
+
} else if (conn.protocol === 'oidc') {
|
|
268
|
+
pass = Boolean(conn.clientId && conn.discoveryUrl && conn.discoveryUrl.includes('.well-known'));
|
|
269
|
+
msg = pass ? 'OIDC Discovery Document 200 OK. Configuration valid.' : 'Failed: Valid Discovery URL and Client ID required.';
|
|
270
|
+
} else {
|
|
271
|
+
pass = Boolean(conn.appId);
|
|
272
|
+
msg = pass ? 'App ID and credentials format valid.' : 'Failed: App ID is required.';
|
|
273
|
+
}
|
|
274
|
+
conn.testStatus = pass ? 'success' : 'failed';
|
|
275
|
+
conn.testMessage = msg;
|
|
276
|
+
}
|
|
277
|
+
conn.lastTestedAt = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
|
278
|
+
onSave?.({ ...conn });
|
|
279
|
+
} finally {
|
|
280
|
+
testingConnectionId = null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function getProtocolBadgeClass(proto: SsoProtocol) {
|
|
285
|
+
switch (proto) {
|
|
286
|
+
case 'saml':
|
|
287
|
+
return 'bg-primary/10 text-primary border-primary/20';
|
|
288
|
+
case 'oidc':
|
|
289
|
+
return 'bg-info/10 text-info dark:text-info border-info/20';
|
|
290
|
+
case 'feishu':
|
|
291
|
+
return 'bg-info/10 text-info dark:text-info border-info/20';
|
|
292
|
+
case 'dingtalk':
|
|
293
|
+
return 'bg-warning/10 text-warning dark:text-warning border-warning/20';
|
|
294
|
+
case 'wecom':
|
|
295
|
+
return 'bg-success/10 text-success dark:text-success border-success/20';
|
|
296
|
+
default:
|
|
297
|
+
return 'bg-muted text-muted-foreground border-border';
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
</script>
|
|
301
|
+
|
|
302
|
+
<div
|
|
303
|
+
class="w-full flex flex-col gap-6 p-6 bg-background text-foreground rounded-xl border border-border shadow-sm {className}"
|
|
304
|
+
data-svadmin-component="SsoConnectionStudio"
|
|
305
|
+
data-svadmin-resource="sso_connections"
|
|
306
|
+
>
|
|
307
|
+
<!-- Header & KPI Overview -->
|
|
308
|
+
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-5 border-b border-border">
|
|
309
|
+
<div class="flex flex-col gap-1">
|
|
310
|
+
<div class="flex items-center gap-2">
|
|
311
|
+
<h2 class="text-xl font-bold tracking-tight text-foreground">企业单点登录配置中心 (SSO Studio)</h2>
|
|
312
|
+
<span class="text-xs px-2 py-0.5 rounded-full font-medium bg-primary/10 text-primary border border-primary/20">
|
|
313
|
+
Enterprise Security
|
|
314
|
+
</span>
|
|
315
|
+
</div>
|
|
316
|
+
<p class="text-sm text-muted-foreground">
|
|
317
|
+
集中管理企业身份提供商 (IdP)、SAML 2.0 / OIDC 协议绑定、企业邮箱域名路由规则及属性映射。
|
|
318
|
+
</p>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<div class="flex items-center gap-2 self-start md:self-auto">
|
|
322
|
+
<button
|
|
323
|
+
type="button"
|
|
324
|
+
onclick={() => (showSpMetadata = !showSpMetadata)}
|
|
325
|
+
class="inline-flex items-center justify-center text-xs font-medium px-3 py-2 rounded-lg border border-border bg-card text-card-foreground hover:bg-muted transition-colors"
|
|
326
|
+
>
|
|
327
|
+
<svg class="w-3.5 h-3.5 mr-1.5 opacity-70" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
328
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
329
|
+
</svg>
|
|
330
|
+
{showSpMetadata ? '收起 SP 元数据' : '查看 SP 元数据'}
|
|
331
|
+
</button>
|
|
332
|
+
|
|
333
|
+
<button
|
|
334
|
+
type="button"
|
|
335
|
+
onclick={openCreateDialog}
|
|
336
|
+
class="inline-flex items-center justify-center text-xs font-semibold px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm"
|
|
337
|
+
>
|
|
338
|
+
<svg class="w-3.5 h-3.5 mr-1.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
339
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
|
340
|
+
</svg>
|
|
341
|
+
新建企业身份源
|
|
342
|
+
</button>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<!-- Copied Toast Alert -->
|
|
347
|
+
{#if copiedNotification}
|
|
348
|
+
<div class="px-3 py-2 text-xs rounded-md bg-success/15 text-success dark:text-success border border-success/30 flex items-center justify-between transition-all">
|
|
349
|
+
<span>已成功复制 {copiedNotification} 至剪贴板!</span>
|
|
350
|
+
</div>
|
|
351
|
+
{/if}
|
|
352
|
+
|
|
353
|
+
<!-- SP Metadata Panel -->
|
|
354
|
+
{#if showSpMetadata}
|
|
355
|
+
<SsoSpMetadataPanel {spEntityId} {spAcsUrl} onCopy={copyText} />
|
|
356
|
+
{/if}
|
|
357
|
+
|
|
358
|
+
<!-- Metrics Strip -->
|
|
359
|
+
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
|
|
360
|
+
<div class="p-3 rounded-lg bg-card border border-border flex flex-col gap-1">
|
|
361
|
+
<span class="text-xs text-muted-foreground">已注册身份源</span>
|
|
362
|
+
<span class="text-xl font-bold text-foreground">{connList.length}</span>
|
|
363
|
+
</div>
|
|
364
|
+
<div class="p-3 rounded-lg bg-card border border-border flex flex-col gap-1">
|
|
365
|
+
<span class="text-xs text-muted-foreground">活跃运行中</span>
|
|
366
|
+
<span class="text-xl font-bold text-success dark:text-success">{activeCount}</span>
|
|
367
|
+
</div>
|
|
368
|
+
<div class="p-3 rounded-lg bg-card border border-border flex flex-col gap-1">
|
|
369
|
+
<span class="text-xs text-muted-foreground">覆盖企业邮箱域名</span>
|
|
370
|
+
<span class="text-xl font-bold text-foreground">{totalDomains}</span>
|
|
371
|
+
</div>
|
|
372
|
+
<div class="p-3 rounded-lg bg-card border border-border flex flex-col gap-1">
|
|
373
|
+
<span class="text-xs text-muted-foreground">默认降级认证源</span>
|
|
374
|
+
<span class="text-sm font-semibold text-foreground truncate">
|
|
375
|
+
{connList.find(c => c.isDefault)?.name || '未设置'}
|
|
376
|
+
</span>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
<!-- Filters & Controls -->
|
|
381
|
+
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
|
382
|
+
<div class="relative flex-1 max-w-sm">
|
|
383
|
+
<input
|
|
384
|
+
type="text"
|
|
385
|
+
bind:value={searchQuery}
|
|
386
|
+
placeholder="搜索身份源名称、匹配域名..."
|
|
387
|
+
class="w-full text-xs px-3 py-2 pl-8 rounded-lg border border-border bg-card text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"
|
|
388
|
+
/>
|
|
389
|
+
<svg class="w-3.5 h-3.5 absolute left-2.5 top-2.5 text-muted-foreground" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
390
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
391
|
+
</svg>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
395
|
+
<!-- Protocol Filter -->
|
|
396
|
+
<select
|
|
397
|
+
bind:value={protocolFilter}
|
|
398
|
+
class="text-xs px-2.5 py-2 rounded-lg border border-border bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-primary"
|
|
399
|
+
>
|
|
400
|
+
<option value="ALL">全部协议</option>
|
|
401
|
+
<option value="saml">SAML 2.0</option>
|
|
402
|
+
<option value="oidc">OpenID Connect (OIDC)</option>
|
|
403
|
+
<option value="oauth2">OAuth 2.0</option>
|
|
404
|
+
<option value="feishu">飞书自建应用</option>
|
|
405
|
+
<option value="dingtalk">钉钉企业应用</option>
|
|
406
|
+
<option value="wecom">企业微信应用</option>
|
|
407
|
+
</select>
|
|
408
|
+
|
|
409
|
+
<!-- Status Filter -->
|
|
410
|
+
<select
|
|
411
|
+
bind:value={statusFilter}
|
|
412
|
+
class="text-xs px-2.5 py-2 rounded-lg border border-border bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-primary"
|
|
413
|
+
>
|
|
414
|
+
<option value="ALL">全部状态</option>
|
|
415
|
+
<option value="active">启用 (Active)</option>
|
|
416
|
+
<option value="inactive">停用 (Inactive)</option>
|
|
417
|
+
</select>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<!-- Connection Cards List -->
|
|
422
|
+
{#if filteredConnections.length === 0}
|
|
423
|
+
<div class="flex flex-col items-center justify-center p-12 rounded-lg border border-dashed border-border bg-muted/20 text-muted-foreground text-xs gap-2">
|
|
424
|
+
<svg class="w-8 h-8 opacity-40" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
425
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
|
|
426
|
+
</svg>
|
|
427
|
+
<span>没有符合条件的身份提供源</span>
|
|
428
|
+
</div>
|
|
429
|
+
{:else}
|
|
430
|
+
<div class="grid grid-cols-1 gap-3">
|
|
431
|
+
{#each filteredConnections as conn (conn.id)}
|
|
432
|
+
<div class="p-4 rounded-xl border border-border bg-card hover:border-primary/40 transition-colors flex flex-col md:flex-row md:items-center justify-between gap-4">
|
|
433
|
+
<!-- Left: Identity Provider Info -->
|
|
434
|
+
<div class="flex flex-col gap-2">
|
|
435
|
+
<div class="flex items-center gap-2.5 flex-wrap">
|
|
436
|
+
<span class="font-semibold text-sm text-foreground">{conn.name}</span>
|
|
437
|
+
<span class="text-[11px] px-2 py-0.5 rounded-full font-medium border {getProtocolBadgeClass(conn.protocol)}">
|
|
438
|
+
{conn.protocol.toUpperCase()}
|
|
439
|
+
</span>
|
|
440
|
+
{#if conn.isDefault}
|
|
441
|
+
<span class="text-[10px] px-2 py-0.5 rounded-full font-semibold bg-warning/10 text-warning dark:text-warning border border-warning/20">
|
|
442
|
+
默认身份源
|
|
443
|
+
</span>
|
|
444
|
+
{/if}
|
|
445
|
+
<div class="flex items-center gap-1.5 ml-1">
|
|
446
|
+
<span
|
|
447
|
+
class="w-2 h-2 rounded-full {conn.status === 'active' ? 'bg-success' : 'bg-muted-foreground/50'}"
|
|
448
|
+
></span>
|
|
449
|
+
<span class="text-xs text-muted-foreground capitalize">{conn.status}</span>
|
|
450
|
+
</div>
|
|
451
|
+
</div>
|
|
452
|
+
|
|
453
|
+
<!-- Domain Match Badges -->
|
|
454
|
+
<div class="flex items-center gap-1.5 flex-wrap text-xs text-muted-foreground">
|
|
455
|
+
<span class="font-medium">关联邮箱后缀:</span>
|
|
456
|
+
{#if conn.domains.length === 0}
|
|
457
|
+
<span class="text-[11px] italic">无专属域名</span>
|
|
458
|
+
{:else}
|
|
459
|
+
{#each conn.domains as domain (domain)}
|
|
460
|
+
<span class="text-[11px] font-mono px-1.5 py-0.5 rounded bg-muted text-foreground border border-border">
|
|
461
|
+
@{domain}
|
|
462
|
+
</span>
|
|
463
|
+
{/each}
|
|
464
|
+
{/if}
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
<!-- Test status and feedback -->
|
|
468
|
+
<div class="flex items-center gap-2 text-xs">
|
|
469
|
+
{#if conn.testStatus === 'success'}
|
|
470
|
+
<span class="inline-flex items-center text-success dark:text-success text-[11px]">
|
|
471
|
+
<svg class="w-3.5 h-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
472
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
|
473
|
+
</svg>
|
|
474
|
+
{conn.testMessage || '握手验证成功'} ({conn.lastTestedAt})
|
|
475
|
+
</span>
|
|
476
|
+
{:else if conn.testStatus === 'failed'}
|
|
477
|
+
<span class="inline-flex items-center text-destructive text-[11px]">
|
|
478
|
+
<svg class="w-3.5 h-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
479
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
480
|
+
</svg>
|
|
481
|
+
{conn.testMessage || '连通性测试异常'}
|
|
482
|
+
</span>
|
|
483
|
+
{:else}
|
|
484
|
+
<span class="text-[11px] text-muted-foreground">尚未进行握手连通性测试</span>
|
|
485
|
+
{/if}
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<!-- Right: Actions -->
|
|
490
|
+
<div class="flex items-center gap-2 self-start md:self-auto flex-wrap">
|
|
491
|
+
<button
|
|
492
|
+
type="button"
|
|
493
|
+
disabled={testingConnectionId === conn.id}
|
|
494
|
+
onclick={() => testConnection(conn)}
|
|
495
|
+
class="text-xs px-2.5 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted text-foreground font-medium transition-colors inline-flex items-center"
|
|
496
|
+
>
|
|
497
|
+
{#if testingConnectionId === conn.id}
|
|
498
|
+
<span class="animate-spin mr-1">⌛</span>
|
|
499
|
+
测试中...
|
|
500
|
+
{:else}
|
|
501
|
+
<svg class="w-3.5 h-3.5 mr-1 text-primary opacity-80" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
502
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
|
503
|
+
</svg>
|
|
504
|
+
测试连通性
|
|
505
|
+
{/if}
|
|
506
|
+
</button>
|
|
507
|
+
|
|
508
|
+
<button
|
|
509
|
+
type="button"
|
|
510
|
+
onclick={() => toggleStatus(conn)}
|
|
511
|
+
class="text-xs px-2.5 py-1.5 rounded-lg border border-border bg-card text-foreground font-medium hover:bg-muted transition-colors"
|
|
512
|
+
>
|
|
513
|
+
{conn.status === 'active' ? '停用' : '启用'}
|
|
514
|
+
</button>
|
|
515
|
+
|
|
516
|
+
{#if !conn.isDefault && conn.status === 'active'}
|
|
517
|
+
<button
|
|
518
|
+
type="button"
|
|
519
|
+
onclick={() => setDefault(conn)}
|
|
520
|
+
class="text-xs px-2 py-1.5 rounded-lg text-muted-foreground hover:text-foreground font-medium transition-colors"
|
|
521
|
+
>
|
|
522
|
+
设为默认
|
|
523
|
+
</button>
|
|
524
|
+
{/if}
|
|
525
|
+
|
|
526
|
+
<button
|
|
527
|
+
type="button"
|
|
528
|
+
onclick={() => openEditDialog(conn)}
|
|
529
|
+
class="text-xs px-2.5 py-1.5 rounded-lg border border-border bg-card text-foreground font-medium hover:bg-muted transition-colors"
|
|
530
|
+
>
|
|
531
|
+
配置
|
|
532
|
+
</button>
|
|
533
|
+
|
|
534
|
+
<button
|
|
535
|
+
type="button"
|
|
536
|
+
onclick={() => deleteConnection(conn.id)}
|
|
537
|
+
class="text-xs px-2 py-1.5 rounded-lg text-destructive hover:bg-destructive/10 transition-colors"
|
|
538
|
+
>
|
|
539
|
+
删除
|
|
540
|
+
</button>
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
{/each}
|
|
544
|
+
</div>
|
|
545
|
+
{/if}
|
|
546
|
+
|
|
547
|
+
<!-- Edit / Add Modal -->
|
|
548
|
+
{#if isEditing}
|
|
549
|
+
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4">
|
|
550
|
+
<div class="w-full max-w-xl max-h-[90vh] overflow-y-auto rounded-xl bg-card border border-border p-6 shadow-xl flex flex-col gap-5 text-foreground">
|
|
551
|
+
<div class="flex items-center justify-between pb-3 border-b border-border">
|
|
552
|
+
<h3 class="text-base font-bold text-foreground">
|
|
553
|
+
{editId.startsWith('conn-') && editName === '' ? '新建企业身份源配置' : '编辑企业身份源配置'}
|
|
554
|
+
</h3>
|
|
555
|
+
<button
|
|
556
|
+
type="button"
|
|
557
|
+
onclick={() => (isEditing = false)}
|
|
558
|
+
class="text-muted-foreground hover:text-foreground text-sm"
|
|
559
|
+
>
|
|
560
|
+
✕
|
|
561
|
+
</button>
|
|
562
|
+
</div>
|
|
563
|
+
|
|
564
|
+
<div class="flex flex-col gap-4 text-xs">
|
|
565
|
+
<!-- Connection Name -->
|
|
566
|
+
<div class="flex flex-col gap-1.5">
|
|
567
|
+
<label for="sso-conn-name" class="font-semibold text-foreground">身份源名称</label>
|
|
568
|
+
<input
|
|
569
|
+
id="sso-conn-name"
|
|
570
|
+
type="text"
|
|
571
|
+
bind:value={editName}
|
|
572
|
+
placeholder="例如:总部 Microsoft Entra ID / 钉钉免密登录"
|
|
573
|
+
class="px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-primary"
|
|
574
|
+
/>
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
<!-- Protocol Choice -->
|
|
578
|
+
<div class="flex flex-col gap-1.5">
|
|
579
|
+
<span class="font-semibold text-foreground">协议类型</span>
|
|
580
|
+
<div class="grid grid-cols-3 gap-2">
|
|
581
|
+
{#each [
|
|
582
|
+
{ id: 'saml', label: 'SAML 2.0' },
|
|
583
|
+
{ id: 'oidc', label: 'OpenID Connect' },
|
|
584
|
+
{ id: 'oauth2', label: 'OAuth 2.0' },
|
|
585
|
+
{ id: 'feishu', label: '飞书自建应用' },
|
|
586
|
+
{ id: 'dingtalk', label: '钉钉企业应用' },
|
|
587
|
+
{ id: 'wecom', label: '企业微信' },
|
|
588
|
+
] as item (item.id)}
|
|
589
|
+
<button
|
|
590
|
+
type="button"
|
|
591
|
+
onclick={() => (editProtocol = item.id as SsoProtocol)}
|
|
592
|
+
class="px-3 py-2 text-center rounded-lg border text-xs font-medium transition-colors {editProtocol === item.id ? 'bg-primary text-primary-foreground border-primary' : 'bg-muted/40 text-muted-foreground border-border hover:bg-muted'}"
|
|
593
|
+
>
|
|
594
|
+
{item.label}
|
|
595
|
+
</button>
|
|
596
|
+
{/each}
|
|
597
|
+
</div>
|
|
598
|
+
</div>
|
|
599
|
+
|
|
600
|
+
<!-- Domains mapping -->
|
|
601
|
+
<div class="flex flex-col gap-1.5">
|
|
602
|
+
<label for="sso-domains" class="font-semibold text-foreground">匹配企业邮箱域名 (以逗号分隔)</label>
|
|
603
|
+
<input
|
|
604
|
+
id="sso-domains"
|
|
605
|
+
type="text"
|
|
606
|
+
bind:value={editDomains}
|
|
607
|
+
placeholder="例如:megacorp.com, subsidiary.com"
|
|
608
|
+
class="px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-primary font-mono"
|
|
609
|
+
/>
|
|
610
|
+
<span class="text-[11px] text-muted-foreground">当登录用户输入匹配域名的邮箱时,系统自动切换至此身份源。</span>
|
|
611
|
+
</div>
|
|
612
|
+
|
|
613
|
+
<!-- Protocol Specific Inputs -->
|
|
614
|
+
{#if editProtocol === 'saml'}
|
|
615
|
+
<div class="p-3 rounded-lg bg-muted/30 border border-border flex flex-col gap-3">
|
|
616
|
+
<span class="font-semibold text-foreground">SAML 2.0 专属参数</span>
|
|
617
|
+
<div class="flex flex-col gap-1">
|
|
618
|
+
<label for="sso-entity-id" class="text-muted-foreground">IdP Entity ID (Issuer)</label>
|
|
619
|
+
<input
|
|
620
|
+
id="sso-entity-id"
|
|
621
|
+
type="text"
|
|
622
|
+
bind:value={editEntityId}
|
|
623
|
+
placeholder="https://sts.windows.net/... 或 http://www.okta.com/..."
|
|
624
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
625
|
+
/>
|
|
626
|
+
</div>
|
|
627
|
+
<div class="flex flex-col gap-1">
|
|
628
|
+
<label for="sso-url" class="text-muted-foreground">Single Sign-On URL (SSO URL)</label>
|
|
629
|
+
<input
|
|
630
|
+
id="sso-url"
|
|
631
|
+
type="text"
|
|
632
|
+
bind:value={editSsoUrl}
|
|
633
|
+
placeholder="https://company.okta.com/app/svadmin/sso/saml"
|
|
634
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
635
|
+
/>
|
|
636
|
+
</div>
|
|
637
|
+
<div class="flex flex-col gap-1">
|
|
638
|
+
<label for="sso-cert" class="text-muted-foreground">X.509 签名证书内容</label>
|
|
639
|
+
<textarea
|
|
640
|
+
id="sso-cert"
|
|
641
|
+
rows="3"
|
|
642
|
+
bind:value={editCert}
|
|
643
|
+
placeholder="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"
|
|
644
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono text-[11px]"
|
|
645
|
+
></textarea>
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
{:else if editProtocol === 'oidc' || editProtocol === 'oauth2'}
|
|
649
|
+
<div class="p-3 rounded-lg bg-muted/30 border border-border flex flex-col gap-3">
|
|
650
|
+
<span class="font-semibold text-foreground">OIDC / OAuth 2.0 专属参数</span>
|
|
651
|
+
<div class="flex flex-col gap-1">
|
|
652
|
+
<label for="sso-discovery-url" class="text-muted-foreground">Discovery URL (.well-known/openid-configuration)</label>
|
|
653
|
+
<input
|
|
654
|
+
id="sso-discovery-url"
|
|
655
|
+
type="text"
|
|
656
|
+
bind:value={editDiscoveryUrl}
|
|
657
|
+
placeholder="https://accounts.google.com/.well-known/openid-configuration"
|
|
658
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
659
|
+
/>
|
|
660
|
+
</div>
|
|
661
|
+
<div class="grid grid-cols-2 gap-2">
|
|
662
|
+
<div class="flex flex-col gap-1">
|
|
663
|
+
<label for="sso-client-id" class="text-muted-foreground">Client ID</label>
|
|
664
|
+
<input
|
|
665
|
+
id="sso-client-id"
|
|
666
|
+
type="text"
|
|
667
|
+
bind:value={editClientId}
|
|
668
|
+
placeholder="Client ID"
|
|
669
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
670
|
+
/>
|
|
671
|
+
</div>
|
|
672
|
+
<div class="flex flex-col gap-1">
|
|
673
|
+
<label for="sso-client-secret" class="text-muted-foreground">Client Secret</label>
|
|
674
|
+
<input
|
|
675
|
+
id="sso-client-secret"
|
|
676
|
+
type="password"
|
|
677
|
+
bind:value={editClientSecret}
|
|
678
|
+
placeholder="••••••••"
|
|
679
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
680
|
+
/>
|
|
681
|
+
</div>
|
|
682
|
+
</div>
|
|
683
|
+
</div>
|
|
684
|
+
{:else}
|
|
685
|
+
<div class="p-3 rounded-lg bg-muted/30 border border-border flex flex-col gap-3">
|
|
686
|
+
<span class="font-semibold text-foreground">办公套件自建应用凭据</span>
|
|
687
|
+
<div class="grid grid-cols-2 gap-2">
|
|
688
|
+
<div class="flex flex-col gap-1">
|
|
689
|
+
<label for="sso-app-id" class="text-muted-foreground">App ID / Client Key</label>
|
|
690
|
+
<input
|
|
691
|
+
id="sso-app-id"
|
|
692
|
+
type="text"
|
|
693
|
+
bind:value={editAppId}
|
|
694
|
+
placeholder="App ID"
|
|
695
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
696
|
+
/>
|
|
697
|
+
</div>
|
|
698
|
+
<div class="flex flex-col gap-1">
|
|
699
|
+
<label for="sso-app-secret" class="text-muted-foreground">App Secret</label>
|
|
700
|
+
<input
|
|
701
|
+
id="sso-app-secret"
|
|
702
|
+
type="password"
|
|
703
|
+
bind:value={editAppSecret}
|
|
704
|
+
placeholder="••••••••"
|
|
705
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
706
|
+
/>
|
|
707
|
+
</div>
|
|
708
|
+
</div>
|
|
709
|
+
{#if editProtocol === 'wecom'}
|
|
710
|
+
<div class="flex flex-col gap-1">
|
|
711
|
+
<label for="sso-corp-id" class="text-muted-foreground">企业微信 Corp ID</label>
|
|
712
|
+
<input
|
|
713
|
+
id="sso-corp-id"
|
|
714
|
+
type="text"
|
|
715
|
+
bind:value={editCorpId}
|
|
716
|
+
placeholder="ww1234567890abcdef"
|
|
717
|
+
class="px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono"
|
|
718
|
+
/>
|
|
719
|
+
</div>
|
|
720
|
+
{/if}
|
|
721
|
+
</div>
|
|
722
|
+
{/if}
|
|
723
|
+
|
|
724
|
+
<!-- Attribute Claims Mapping -->
|
|
725
|
+
<div class="flex flex-col gap-2">
|
|
726
|
+
<div class="flex items-center justify-between">
|
|
727
|
+
<span class="font-semibold text-foreground">用户属性映射 (Claims Mapping)</span>
|
|
728
|
+
<button
|
|
729
|
+
type="button"
|
|
730
|
+
onclick={addClaimMapping}
|
|
731
|
+
class="text-[11px] text-primary hover:underline"
|
|
732
|
+
>
|
|
733
|
+
+ 添加映射字段
|
|
734
|
+
</button>
|
|
735
|
+
</div>
|
|
736
|
+
<div class="flex flex-col gap-1.5">
|
|
737
|
+
{#each editClaimMappings as mapping, idx (idx)}
|
|
738
|
+
<div class="flex items-center gap-2">
|
|
739
|
+
<input
|
|
740
|
+
type="text"
|
|
741
|
+
bind:value={mapping.remoteClaim}
|
|
742
|
+
placeholder="IdP 字段 (如 sub / email)"
|
|
743
|
+
class="flex-1 px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono text-[11px]"
|
|
744
|
+
/>
|
|
745
|
+
<span class="text-muted-foreground">➔</span>
|
|
746
|
+
<input
|
|
747
|
+
type="text"
|
|
748
|
+
bind:value={mapping.localField}
|
|
749
|
+
placeholder="本地字段 (如 email / name)"
|
|
750
|
+
class="flex-1 px-2.5 py-1.5 rounded border border-border bg-background text-foreground font-mono text-[11px]"
|
|
751
|
+
/>
|
|
752
|
+
<button
|
|
753
|
+
type="button"
|
|
754
|
+
onclick={() => removeClaimMapping(idx)}
|
|
755
|
+
class="text-muted-foreground hover:text-destructive px-1 text-xs"
|
|
756
|
+
>
|
|
757
|
+
✕
|
|
758
|
+
</button>
|
|
759
|
+
</div>
|
|
760
|
+
{/each}
|
|
761
|
+
</div>
|
|
762
|
+
</div>
|
|
763
|
+
</div>
|
|
764
|
+
|
|
765
|
+
<div class="flex items-center justify-end gap-2 pt-3 border-t border-border">
|
|
766
|
+
<button
|
|
767
|
+
type="button"
|
|
768
|
+
onclick={() => (isEditing = false)}
|
|
769
|
+
class="px-4 py-2 text-xs rounded-lg border border-border bg-card text-foreground hover:bg-muted font-medium transition-colors"
|
|
770
|
+
>
|
|
771
|
+
取消
|
|
772
|
+
</button>
|
|
773
|
+
<button
|
|
774
|
+
type="button"
|
|
775
|
+
onclick={saveConnection}
|
|
776
|
+
class="px-4 py-2 text-xs rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 font-semibold transition-colors shadow-sm"
|
|
777
|
+
>
|
|
778
|
+
保存并应用
|
|
779
|
+
</button>
|
|
780
|
+
</div>
|
|
781
|
+
</div>
|
|
782
|
+
</div>
|
|
783
|
+
{/if}
|
|
784
|
+
</div>
|