Class AuthWebService
java.lang.Object
ubic.gemma.rest.AuthWebService
Bearer-token auth endpoints for the curation-UI SPA. Implements Option C of
AUTH_FOR_SPA_RECCE.md: opaque token minted on credential check,
sent on every subsequent call as Authorization: Bearer <token>.
Wire contract (matches what the SPA's
gemma-curation-ui/apps/curation/src/api/session.ts expects):
POST /rest/v2/login {"username", "password"} → 200 {"token", "user"}
POST /rest/v2/logout → 200 (idempotent)
GET /rest/v2/me → 200 user|null
Note: the legacy HTTP Basic chain is preserved for CLI / RClient / cron clients;
see RestSecurityConfig for the filter ordering.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classJSON body forPOST /login.static final classWire payload forPOST /login—{token, user}. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseVerify credentials, mint a new opaque bearer token, and return both the token and the canonical user shape (mirrorsGET /rest/v2/users/me).jakarta.ws.rs.core.Responselogout(jakarta.servlet.http.HttpServletRequest request) Revoke the bearer token presented in theAuthorizationheader.me()Convenience alias forGET /rest/v2/users/me; the curation-UI SPA'suseMe()hook points at/rest/v2/meverbatim, so we mirror the shape here rather than asking the SPA to track the longer path.
-
Constructor Details
-
AuthWebService
public AuthWebService()
-
-
Method Details
-
login
@POST @Path("/login") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response login(AuthWebService.LoginRequest req) Verify credentials, mint a new opaque bearer token, and return both the token and the canonical user shape (mirrorsGET /rest/v2/users/me).Anonymous callers and bad credentials produce 401. Empty payload produces 400.
-
logout
@POST @Path("/logout") @Produces("application/json") public jakarta.ws.rs.core.Response logout(@Context jakarta.servlet.http.HttpServletRequest request) Revoke the bearer token presented in theAuthorizationheader. Idempotent — revoking an unknown / already-revoked token is a 200 with empty body, matching the SPA's expectation that logout always "succeeds" so it can clear local state unconditionally. -
me
@GET @Path("/me") @Produces("application/json") @PreAuthorize("isAuthenticated()") public ResponseDataObject<RootWebService.UserValueObject> me()Convenience alias forGET /rest/v2/users/me; the curation-UI SPA'suseMe()hook points at/rest/v2/meverbatim, so we mirror the shape here rather than asking the SPA to track the longer path.Returns the canonical
RootWebService.UserValueObject(same asRootWebService.getMyself()).
-