Class MeHandler
GET /api/v2/auth/me.
Returns the current authentication state. When the session has a bound
FessUserBean the response includes the user's id, roles, groups,
permissions, and editable flag; otherwise just authenticated:false
so anonymous callers receive a stable, well-formed envelope rather than a
401 (the v2 contract treats "anonymous" as a valid state, not an error).
MJ-28: The user shape is produced by UserPayloads.toJson(FessUserBean)
to guarantee wire-identity with LoginHandler. All array fields are always JSON
arrays, never null.
MJ-30 i18n contract: error.message values in this handler are
developer-facing English strings. Clients MUST use error.code
(the V2ErrorCode token) for user-facing i18n.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> Resolves the saved login user bean.voidhandle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Processes one/api/v2/auth/meGET request.
-
Constructor Details
-
MeHandler
public MeHandler()Default constructor. The handler is stateless and intended to be instantiated once by the API manager and shared across concurrent requests.
-
-
Method Details
-
handle
public void handle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException Processes one/api/v2/auth/meGET request.Rejects non-
GETmethods withV2ErrorCode.METHOD_NOT_ALLOWED. Resolves the boundFessUserBeanfrom the login subsystem (treating any lookup failure as anonymous), then writes a success envelope describing the current authentication state — including the user payload viaUserPayloads.toJson(FessUserBean)when authenticated, or justauthenticated:falseotherwise.- Parameters:
req- the incoming HTTP requestres- the HTTP response to write to- Throws:
IOException- if writing the envelope fails
-
getSavedUserBean
protected org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> getSavedUserBean()Resolves the saved login user bean. Exposed as a seam so unit tests can supply a stub user (or an empty/anonymous result) by overriding this method, instead of registering aFessLoginAssiststub viaComponentUtil.register.- Returns:
- the saved user bean, or empty when no user is logged in
-