Class MockAuthSessionController

java.lang.Object
io.leandev.appfuse.security.auth.mock.MockAuthSessionController

@RestController @ConditionalOnProperty(prefix="app.msw", name="enabled", havingValue="true") @RequestMapping("/api/v1/auth/__mock-session") public class MockAuthSessionController extends Object

Native HTTP adapter for process-scoped MSW authentication sessions.

The browser receives only an HttpOnly cookie. Session metadata and credential hashes live in the host process through the framework RefreshSessionStore SPI, so a page reload cannot erase them. Applications must explicitly compose this controller; the framework does not auto-configure it. Do not rely on broad component scanning for this package: RestController only makes an explicitly created bean visible to Spring MVC. The condition prevents an inactive mock adapter from being constructed by an accidental scan; register inMemory() or inMemory(String) from a mock-only configuration instead.

  • Field Details

  • Method Details

    • inMemory

      public static MockAuthSessionController inMemory()
      建立採框架預設 Cookie 名稱、生命週期綁定目前 host process 的 in-memory adapter。
    • inMemory

      public static MockAuthSessionController inMemory(String cookieName)
      建立可覆寫 Cookie 名稱的 in-memory adapter;產品 credential 仍不會進入 Browser storage。 若 Vite mock adapter 也覆寫 Cookie 名稱,兩端必須傳入同一值。
    • inMemoryWithAccessSessions

      public static MockAuthSessionController inMemoryWithAccessSessions(MockAccessSessionOptions options)
      明示啟用 opaque Access Session;既有 factory 與 legacy route 的預設契約不變。
    • accessSession

      @RequestMapping(value={"/access-sessions","/access-sessions/refresh","/access-sessions/inspect","/access-sessions/revoke"}, method={POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE}) public org.springframework.http.ResponseEntity<Map<String,Object>> accessSession(@RequestBody(required=false) String body, jakarta.servlet.http.HttpServletRequest request)
    • issue

      @PostMapping("/issue") public org.springframework.http.ResponseEntity<Map<String,Object>> issue(@RequestBody MockAuthSessionController.IssueRequest input, jakarta.servlet.http.HttpServletRequest request)
    • refresh

      @PostMapping("/refresh") public org.springframework.http.ResponseEntity<Map<String,Object>> refresh(jakarta.servlet.http.HttpServletRequest request)
    • replace

      @PostMapping("/replace") public org.springframework.http.ResponseEntity<Map<String,Object>> replace(@RequestBody MockAuthSessionController.IssueRequest input, jakarta.servlet.http.HttpServletRequest request)
    • revoke

      @PostMapping("/revoke") public org.springframework.http.ResponseEntity<Map<String,Object>> revoke(@RequestBody(required=false) MockAuthSessionController.RevokeRequest input, jakarta.servlet.http.HttpServletRequest request)