Skip to content

Commit dccd6d7

Browse files
authored
refactor(account)!: remove app allowed origins (#3378)
1 parent 08a6362 commit dccd6d7

6 files changed

Lines changed: 11 additions & 62 deletions

File tree

docs/openapi.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5409,8 +5409,6 @@ paths:
54095409
$ref: "#/components/schemas/AccountApp/properties/clientType"
54105410
redirectURIs:
54115411
$ref: "#/components/schemas/AccountApp/properties/redirectURIs"
5412-
allowedOrigins:
5413-
$ref: "#/components/schemas/AccountApp/properties/allowedOrigins"
54145412
responses:
54155413
"201":
54165414
description: Account app created.
@@ -5489,8 +5487,6 @@ paths:
54895487
$ref: "#/components/schemas/AccountApp/properties/status"
54905488
redirectURIs:
54915489
$ref: "#/components/schemas/AccountApp/properties/redirectURIs"
5492-
allowedOrigins:
5493-
$ref: "#/components/schemas/AccountApp/properties/allowedOrigins"
54945490
responses:
54955491
"200":
54965492
description: Account app updated.
@@ -6667,7 +6663,6 @@ components:
66676663
- status
66686664
- redirectURIs
66696665
- redirectURIPatterns
6670-
- allowedOrigins
66716666
properties:
66726667
id:
66736668
$ref: "#/components/schemas/Model/properties/id"
@@ -6743,16 +6738,6 @@ components:
67436738
type: string
67446739
examples:
67456740
- - https://app-*.example.com/oauth/callback
6746-
allowedOrigins:
6747-
description: |
6748-
Allowed web origins.
6749-
6750-
Production web origins must use `https`, must not include path, query, or fragment, and must be matched
6751-
exactly by the server.
6752-
type: array
6753-
items:
6754-
type: string
6755-
format: uri
67566741

67576742
AccountAppSecret:
67586743
type: object

spx-gui/src/apis/account/common.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ export type AccountApp = AccountModel & {
7070
redirectURIs: string[]
7171
/** Read-only allowed redirect URI patterns */
7272
redirectURIPatterns: string[]
73-
/** Allowed web origins */
74-
allowedOrigins: string[]
7573
}
7674

7775
export type AccountAppSecret = {

spx-gui/src/apis/admin/account.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ export type CreateAccountAppParams = {
194194
clientType: AccountAppClientType
195195
/** Allowed redirect URIs */
196196
redirectURIs: string[]
197-
/** Allowed web origins */
198-
allowedOrigins?: string[]
199197
}
200198

201199
export function createAccountApp(params: CreateAccountAppParams) {
@@ -213,8 +211,6 @@ export type UpdateAccountAppParams = {
213211
status?: AccountAppStatus
214212
/** Allowed redirect URIs */
215213
redirectURIs?: string[]
216-
/** Allowed web origins */
217-
allowedOrigins?: string[]
218214
}
219215

220216
export function updateAccountApp(appID: string, params: UpdateAccountAppParams) {

spx-gui/src/apps/xbuilder/pages/admin/app.vue

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import CopyButton from '@/components/common/CopyButton.vue'
1212
import UIIcon from '@/components/ui/icons/UIIcon.vue'
1313
import * as accountAdminApis from '@/apis/admin/account'
1414
import {
15-
accountAppAllowedOriginsTip,
1615
accountAppClientTypeLabels,
1716
accountAppRedirectURIPatternsTip,
1817
accountAppRedirectURIsTip,
@@ -52,11 +51,9 @@ usePageTitle(() =>
5251
const displayName = ref('')
5352
const status = ref<accountAdminApis.AccountApp['status']>('active')
5453
const redirectURIs = ref('')
55-
const allowedOrigins = ref('')
5654
const savedDisplayName = ref('')
5755
const savedStatus = ref<accountAdminApis.AccountApp['status']>('active')
5856
const savedRedirectURIs = ref<string[]>([])
59-
const savedAllowedOrigins = ref<string[]>([])
6057
const appUpdatedAt = ref('')
6158
const appFallbackText = computed(() => displayName.value.trim().charAt(0).toUpperCase() || '?')
6259
const trimmedDisplayName = computed(() => displayName.value.trim())
@@ -68,28 +65,22 @@ watch(
6865
displayName.value = value.displayName
6966
status.value = value.status
7067
redirectURIs.value = value.redirectURIs.join('\n')
71-
allowedOrigins.value = value.allowedOrigins.join('\n')
7268
savedDisplayName.value = value.displayName
7369
savedStatus.value = value.status
7470
savedRedirectURIs.value = value.redirectURIs
75-
savedAllowedOrigins.value = value.allowedOrigins
7671
appUpdatedAt.value = value.updatedAt
7772
},
7873
{ immediate: true }
7974
)
8075
8176
const parsedRedirectURIs = computed(() => parseLines(redirectURIs.value))
82-
const parsedAllowedOrigins = computed(() => parseLines(allowedOrigins.value))
8377
const isActive = computed(() => status.value === 'active')
8478
const isIdentityChanged = computed(
8579
() => trimmedDisplayName.value !== '' && trimmedDisplayName.value !== savedDisplayName.value
8680
)
8781
const isStatusChanged = computed(() => status.value !== savedStatus.value)
88-
const areEndpointsChanged = computed(
89-
() =>
90-
parsedRedirectURIs.value.length > 0 &&
91-
(!areStringListsEqual(parsedRedirectURIs.value, savedRedirectURIs.value) ||
92-
!areStringListsEqual(parsedAllowedOrigins.value, savedAllowedOrigins.value))
82+
const areRedirectURIsChanged = computed(
83+
() => parsedRedirectURIs.value.length > 0 && !areStringListsEqual(parsedRedirectURIs.value, savedRedirectURIs.value)
9384
)
9485
9586
function areStringListsEqual(a: string[], b: string[]) {
@@ -123,14 +114,12 @@ const handleUpdateIdentity = useMessageHandle(
123114
{ en: 'App identity updated', zh: '应用信息已更新' }
124115
)
125116
126-
const handleUpdateEndpoints = useMessageHandle(
117+
const handleUpdateRedirectURIs = useMessageHandle(
127118
async () => {
128119
const updated = await accountAdminApis.updateAccountApp(props.appID, {
129-
redirectURIs: parsedRedirectURIs.value,
130-
allowedOrigins: parsedAllowedOrigins.value
120+
redirectURIs: parsedRedirectURIs.value
131121
})
132122
savedRedirectURIs.value = updated.redirectURIs
133-
savedAllowedOrigins.value = updated.allowedOrigins
134123
appUpdatedAt.value = updated.updatedAt
135124
},
136125
{ en: 'Failed to update OAuth endpoints', zh: '更新 OAuth 地址配置失败' },
@@ -339,13 +328,13 @@ function deleteSecret(secretID: string) {
339328
<p class="m-0 mt-1 text-sm text-grey-800">
340329
{{
341330
$t({
342-
en: 'Exact destinations and browser origins trusted by this app.',
343-
zh: '此应用信任的精确回调地址和浏览器来源。'
331+
en: 'Exact callback destinations trusted by this app.',
332+
zh: '此应用信任的精确回调地址。'
344333
})
345334
}}
346335
</p>
347336
</div>
348-
<form class="flex flex-col gap-5" @submit.prevent="handleUpdateEndpoints.fn">
337+
<form class="flex flex-col gap-5" @submit.prevent="handleUpdateRedirectURIs.fn">
349338
<label class="flex flex-col gap-1 text-sm text-grey-900">
350339
{{ $t({ en: 'Redirect URIs', zh: '回调 URI' }) }}
351340
<UITextInput v-model:value="redirectURIs" type="textarea" :rows="5" />
@@ -364,17 +353,12 @@ function deleteSecret(secretID: string) {
364353
</div>
365354
<span class="text-xs text-grey-700">{{ $t(accountAppRedirectURIPatternsTip) }}</span>
366355
</div>
367-
<label class="flex flex-col gap-1 text-sm text-grey-900">
368-
{{ $t({ en: 'Allowed origins', zh: '允许的 Origin' }) }}
369-
<UITextInput v-model:value="allowedOrigins" type="textarea" :rows="4" />
370-
<span class="text-xs text-grey-700">{{ $t(accountAppAllowedOriginsTip) }}</span>
371-
</label>
372356
<div class="flex justify-end">
373357
<UIButton
374358
html-type="submit"
375359
type="primary"
376-
:disabled="!areEndpointsChanged"
377-
:loading="handleUpdateEndpoints.isLoading.value"
360+
:disabled="!areRedirectURIsChanged"
361+
:loading="handleUpdateRedirectURIs.isLoading.value"
378362
>
379363
{{ $t({ en: 'Save endpoint settings', zh: '保存地址配置' }) }}
380364
</UIButton>

spx-gui/src/apps/xbuilder/pages/admin/apps.vue

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { useSignedInStateQuery } from '@/stores/user'
1111
import { UIButton, UIError, UILoading, UIPagination, UISelect, UISelectOption, UITextInput } from '@/components/ui'
1212
import * as accountAdminApis from '@/apis/admin/account'
1313
import {
14-
accountAppAllowedOriginsTip,
1514
accountAppClientTypeLabels,
1615
accountAppRedirectURIsTip,
1716
accountAppStatusLabels,
@@ -33,8 +32,7 @@ const createForm = reactive({
3332
name: '',
3433
displayName: '',
3534
clientType: 'public' as accountAdminApis.AccountApp['clientType'],
36-
redirectURIs: '',
37-
allowedOrigins: ''
35+
redirectURIs: ''
3836
})
3937
4038
const appsQuery = useQuery(
@@ -60,8 +58,7 @@ const handleCreateApp = useMessageHandle(
6058
name: createForm.name.trim(),
6159
displayName: createForm.displayName.trim(),
6260
clientType: createForm.clientType,
63-
redirectURIs: parseLines(createForm.redirectURIs),
64-
allowedOrigins: parseLines(createForm.allowedOrigins)
61+
redirectURIs: parseLines(createForm.redirectURIs)
6562
})
6663
await router.push(`/admin/apps/${encodeURIComponent(app.id)}`)
6764
},
@@ -110,17 +107,11 @@ const handleCreateApp = useMessageHandle(
110107
<UISelectOption value="confidential">{{ $t(accountAppClientTypeLabels.confidential) }}</UISelectOption>
111108
</UISelect>
112109
</label>
113-
<div class="hidden tablet:block"></div>
114110
<label class="flex flex-col gap-1 text-sm text-grey-900">
115111
{{ $t({ en: 'Redirect URIs', zh: '回调 URI' }) }}
116112
<UITextInput v-model:value="createForm.redirectURIs" type="textarea" :rows="4" />
117113
<span class="text-xs text-grey-700">{{ $t(accountAppRedirectURIsTip) }}</span>
118114
</label>
119-
<label class="flex flex-col gap-1 text-sm text-grey-900">
120-
{{ $t({ en: 'Allowed origins', zh: '允许的 Origin' }) }}
121-
<UITextInput v-model:value="createForm.allowedOrigins" type="textarea" :rows="4" />
122-
<span class="text-xs text-grey-700">{{ $t(accountAppAllowedOriginsTip) }}</span>
123-
</label>
124115
</div>
125116
<div class="mt-4 flex justify-end">
126117
<UIButton html-type="submit" type="primary" :loading="handleCreateApp.isLoading.value">

spx-gui/src/apps/xbuilder/pages/admin/common.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ export const accountAppRedirectURIPatternsTip: LocaleMessage = {
2828
zh: '用于受控预览或非生产回调域名的只读通配模式。精确回调 URI 仍是主要 allowlist;这组模式不通过公开 Admin API 管理,也不能在这里修改。'
2929
}
3030

31-
export const accountAppAllowedOriginsTip: LocaleMessage = {
32-
en: 'Origins allowed to host Account Web and receive identity provider callbacks for this app. Enter one origin per line, such as https://account.example.com. Do not include a path, query, or fragment.',
33-
zh: '允许承载 Account Web 并接收本应用第三方身份提供商回调的 Origin。每行一个,例如 https://account.example.com;不要包含路径、查询参数或 fragment。'
34-
}
35-
3631
export function formatTime(value: string) {
3732
return dayjs(value).format('YYYY-MM-DD HH:mm')
3833
}

0 commit comments

Comments
 (0)