Package com.mcawful
Class PanelPasskeyHandler
java.lang.Object
com.mcawful.PanelPasskeyHandler
Passkey registration, management and sign-in for
panel users.
Registration and management run over the authenticated panel websocket, so a user can
only ever touch their own passkeys. Sign-in runs over HTTP so the bot can set the session
cookie of PanelSessionManager.
- Author:
- mcawful
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeletePasskeys(String username) Removes all passkeys of a panel user and ends their sessions.static voidhandleHttp(ChannelHandlerContext ctx, FullHttpRequest req) Handles a request to/panel/login/passkey/, which the login page uses to sign in with a passkey.static voidhandleWs(ChannelHandlerContext ctx, PanelUser user, JSONObject request, JSONStringer response) Handles apasskeyquery on the panel websocketstatic voidrenamePasskeys(String username, String newUsername) Moves all passkeys of a panel user to a new username and ends their sessions.
-
Method Details
-
handleWs
public static void handleWs(ChannelHandlerContext ctx, PanelUser user, JSONObject request, JSONStringer response) Handles apasskeyquery on the panel websocket- Parameters:
ctx- theChannelHandlerContextof the websocketuser- the authenticatedPanelUserrequest- thepasskeyobject of the query, which must have anactionresponse- theJSONStringerto write the single result value to
-
handleHttp
Handles a request to/panel/login/passkey/, which the login page uses to sign in with a passkey. These requests are not authenticated- Parameters:
ctx- theChannelHandlerContextof the requestreq- theFullHttpRequest
-
deletePasskeys
Removes all passkeys of a panel user and ends their sessions. Must be called when the user is deleted, so a later user with the same name does not inherit them, and when their password is reset, so nobody who had access keeps it- Parameters:
username- the user's name
-
renamePasskeys
Moves all passkeys of a panel user to a new username and ends their sessions. Must be called when the user is renamed. Passkeys that were left under the new name are removed first, so the user does not inherit them- Parameters:
username- the user's current namenewUsername- the user's new name
-