This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Skeleton Key is a Joomla 4/5/6 extension package that allows administrators to log into the frontend as any other user for troubleshooting purposes. It uses single-use secure tokens with short expiration windows, stored in the #__user_keys database table.
The build uses Apache Phing with shared build infrastructure located at ../buildfiles/. The Babel toolchain for JS is also in ../buildfiles/node_modules/.
Build the release package:
phingThis runs the default git target which compiles JavaScript and creates plugin ZIP packages.
Compile JavaScript only:
phing compile-javascriptThis transpiles plugins/system/skeletonkey/media/js/backend.js → backend.min.js + source map using Babel with @babel/preset-env and minify.
Create a GitHub release:
phing releaseThe package consists of three coordinated Joomla plugins that communicate via Joomla's event system:
The main orchestrator. Injects "Login as user" buttons into the admin users list (onBeforeDisplay), handles AJAX token creation (onAjaxSkeletonkey), and detects/validates cookies on frontend page load (onAfterInitialise). The frontend JavaScript lives in media/js/backend.js.
Validates tokens during the Joomla authentication flow (onUserAuthenticate). Verifies the token hash from the cookie against the database, enforces expiration, and implements attack detection (purges all tokens for a user if a replayed token is detected). Cleans up cookies on logout (onUserAfterLogout).
Audit trail. Listens for onSkeletonKeyRequestLogin events and logs which admin requested login as which user, plus success/failure.
- Admin clicks "Login as user" button in backend users list
- JavaScript sends AJAX request → System plugin generates a random token, stores its hash in
#__user_keyswith short TTL, sets an HTTP-only cookie with the plaintext token - New browser tab opens to the frontend
- System plugin's
onAfterInitialisedetects the cookie and triggers Joomla authentication - Authentication plugin validates the token (single-use, checks expiration, verifies hash)
- Action Log plugin records the event
Each plugin registers via services/provider.php using Joomla's DI container pattern, implementing ServiceProviderInterface to register the extension with PluginInterface.
allowedControlGroups— user groups permitted to initiate login-as (default: 8 / Super Users)allowedTargetGroups— user groups that can be logged in as (default: 2 / Registered)disallowedTargetGroups— user groups that cannot be logged in as (default: 7,8 / Admin & Super User)cookie_lifetime— token expiration in seconds (default: 10)key_length— random token length in characters (default: 32)
Localization files are in INI format under each plugin's language/ directory. Supported: en-GB, el-GR, nl-NL.