腾龙娱乐游戏官网 xs10159.com
不变量守住的不是代码洁癖,而是资金、库存、履约和合规底线。真正危险的不是语法错误,而是“技术上正确、业务上错误”。聚合定义一致性边界,不变量定义必须始终成立的规则:未支付订单不能发货;余额不能小于冻结金额;优惠券不能重复核销。规则应由领域模型集中守护。当不变量被写进聚合,AI 可以重构接口、生成适配器,却不能绕过领域入口随意修改状态。架构不再依靠“请小心一点”的提示词维持,而由代码边界和测试共同执行。每一次拒绝非法状态迁移,都可能是在避免一次超卖、错付、违规或客户投诉**`CoSecPrincipal`** — represents a user/agent with id, roles, policies, and attributes. Extends `java.security.Principal`. Root users bypass all checks.- **`Authentication<C, P>`** — reactive interface (`Mono`-based) that verifies credentials and returns a `CoSecPrincipal`.- **`Authorization`** — reactive interface that evaluates a `Request` against a `SecurityContext` and returns `AuthorizeResult` (ALLOW/EXPLICIT_DENY/IMPLICIT_DENY).- **`Policy`** — collection of `Statement`s with an optional `ConditionMatcher`. Policy evaluation: check condition → DENY statements first → ALLOW statements. Default is implicit deny.- **`Statement`** — single permission rule with `Effect` (ALLOW/DENY), `ActionMatcher`, and `ConditionMatcher`.- **`SecurityContext`** — holds the current principal, tenant info, and mutable attributes.
页:
[1]