package vip.mate.kbopen.auth; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Declares the minimum scope required by a KB Open API endpoint. * *

Processed by {@code KbScopeInterceptor} which checks, in order: *

    *
  1. A {@link KbApiKeyContext} exists on the request (filter ran).
  2. *
  3. The context's scopes include the annotation value or {@code kb:*}.
  4. *
  5. The path's {@code kbId} variable is in the context's bound KB set.
  6. *
* *

This mirrors the existing {@code @RequireWorkspaceRole} + * {@code WorkspaceAccessInterceptor} pattern, centralizing authorization so * it is not hand-written per endpoint (A1 — avoids repeating the #438/#439 * Wiki IDOR pattern on the outward-facing API). */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface RequireKbScope { /** Required scope, e.g. {@code "kb:search"}, {@code "kb:read"}. */ String value(); }