feat(mobile-api): admin guard on /api/admin/** (admin token, session state, module grants)

Ported from babyboo: @AdminModule, AdminModuleAccess, AdminSessionGuard and the
admin branch of AppAccessAspect. Adds the BO area, and services-auth findUserByToken
now returns no user for a logged-out token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-11-26 19:44:03 +08:00
1 parent 72b724f468
commit 0a990cbcaf
16 files changed
+850 -8

No files matched your search

@@ -0,0 +1,30 @@
package com.solvway.mobile.api.controller.admin;
import com.solvway.mobile.api.useraccess.AppAccessAspect;
import org.aspectj.lang.annotation.Around;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import java.lang.reflect.Method;
import static org.assertj.core.api.Assertions.assertThat;
/** Controllers in controller subpackages (admin controllers live in controller.admin) must pass the access aspect. */
class AdminControllerPointcutTest {
static class ProbeController {
public String handler() {
return "ok";
}
}
@Test
void accessAspectCoversControllerSubpackages() throws Exception {
Method advice = AppAccessAspect.class.getMethod("appAccessAuthCheck", org.aspectj.lang.ProceedingJoinPoint.class);
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression(advice.getAnnotation(Around.class).value());
Method handler = ProbeController.class.getMethod("handler");
assertThat(pointcut.matches(handler, ProbeController.class)).isTrue();
}
}