mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
feat(oauth): 实现 OAuth 回调服务器与完整令牌管理功能
- 新增 OAuth 回调服务器模块,支持本地 HTTP 服务器处理授权回调 - 添加令牌撤销和令牌内省 API 端点 - 重构 OAuth 授权流程,增加 state 参数防止 CSRF 攻击 - 改进前端 OAuth 登录组件,适配新的回调机制
This commit is contained in:
@@ -8,7 +8,11 @@ import {
|
||||
type JsonRule,
|
||||
} from "@react-awesome-query-builder/antd"
|
||||
import type { TFunction } from "i18next"
|
||||
import { IntervalValueWidget, parseIntervalTriggerValue, stringifyIntervalTriggerValue } from "./IntervalValueWidget"
|
||||
import {
|
||||
IntervalValueWidget,
|
||||
parseIntervalTriggerValue,
|
||||
stringifyIntervalTriggerValue,
|
||||
} from "./IntervalValueWidget"
|
||||
|
||||
export interface AutoScoreTrigger {
|
||||
event: string
|
||||
@@ -76,9 +80,7 @@ const toStringValue = (value: unknown): string => {
|
||||
}
|
||||
|
||||
const normalizeTagValues = (values: unknown[]): string[] => {
|
||||
const normalized = values
|
||||
.map((value) => toStringValue(value).trim())
|
||||
.filter(Boolean)
|
||||
const normalized = values.map((value) => toStringValue(value).trim()).filter(Boolean)
|
||||
|
||||
return Array.from(new Set(normalized))
|
||||
}
|
||||
@@ -265,7 +267,10 @@ export const createTriggerQueryConfig = (t: TFunction, tagOptions: AutoScoreTagO
|
||||
export const createEmptyTriggerTree = (config: Config): ImmutableTree =>
|
||||
QbUtils.checkTree(QbUtils.loadTree(buildEmptyGroup()), config)
|
||||
|
||||
export const triggersToQueryTree = (config: Config, triggers: AutoScoreTrigger[]): ImmutableTree => {
|
||||
export const triggersToQueryTree = (
|
||||
config: Config,
|
||||
triggers: AutoScoreTrigger[]
|
||||
): ImmutableTree => {
|
||||
const children = triggers.map(ruleFromTrigger).filter((item): item is JsonRule => Boolean(item))
|
||||
const group: JsonGroup = {
|
||||
...buildEmptyGroup(),
|
||||
@@ -282,7 +287,8 @@ export const queryTreeToTriggers = (tree: ImmutableTree, config: Config): AutoSc
|
||||
}
|
||||
|
||||
const hasUnsupportedLogicInGroup = (group: JsonGroup): boolean => {
|
||||
const conjunction = typeof group.properties?.conjunction === "string" ? group.properties.conjunction : "AND"
|
||||
const conjunction =
|
||||
typeof group.properties?.conjunction === "string" ? group.properties.conjunction : "AND"
|
||||
const not = Boolean(group.properties?.not)
|
||||
|
||||
if (conjunction !== "AND" || not) {
|
||||
|
||||
Reference in New Issue
Block a user