Interface CurrentUserProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies the current request's acting user id.
提供当前请求的操作人 userId。
The engine calls this SPI whenever it needs to know "who is making the
call now" (for ownership pre-check, history operator_id, etc.).
A typical adapter pulls the id from the host's security context (Spring
Security, JAX-RS principal, custom MDC, …).
引擎在需要确定"谁在调用"时调用本 SPI(所有权前置校验、history 的
operator_id 等)。典型实现从宿主的安全上下文(Spring Security、
JAX-RS Principal、自定义 MDC 等)抽取 userId。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CurrentUserProviderNo-op provider that always returnsnull; the engine treats this as "no authenticated principal — engine-level authz checks are skipped". -
Method Summary
Modifier and TypeMethodDescriptionReturns the current user id, ornullwhen no user is bound to the calling thread.
-
Field Details
-
NO_OP
No-op provider that always returnsnull; the engine treats this as "no authenticated principal — engine-level authz checks are skipped". Hosts that ship without a real provider implicitly opt into this permissive default (and assume responsibility for enforcing authorisation at their own API boundary). 始终返回null的空实现;引擎视其为"无认证主体 —— 跳过引擎层鉴权"。 没有装配真实 provider 的宿主默认走此宽松实现(须自行在 API 边界做鉴权)。- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Method Details
-
currentUserId
String currentUserId()Returns the current user id, ornullwhen no user is bound to the calling thread. 返回当前 userId;当前线程未绑定用户时返回null。- Returns:
- current user id, or
null— 当前 userId,或null - Since:
- JDK 25, opencode-base-flow V1.0.5
-