apache / apache/texera

Allow admins to log in as (impersonate) any user for debugging

Open
#6,060 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Feature Summary
Texera uses Google OAuth for user login, so admins cannot sign in as a user with their credentials. Today, whenever a user hits a problem, we have to ask them to share their datasets, computing units, and workflows just so we can see whether everything is working on their account. This feature lets an admin log in as any user seamlessly from the admin user-management page, so admins can reproduce and debug user-specific issues directly instead of round-tripping with the user.
### Proposed Solution or Design
Add an admin-only endpoint that mints a JWT for a target user (identical to the token a normal login would produce), plus a UI affordance to switch into and out of that session.
- Backend: `POST /admin/user/impersonate/{uid}` on `AdminUserResource` (already guarded by class-level `@RolesAllowed("ADMIN")`) issues a JWT for the target user through the existing `jwtToken(jwtClaims(user, ...))` path used by login. Returns 404 if the user does not exist and 400 if the user is INACTIVE.
- Frontend: a per-row button in `/dashboard/admin/user` swaps the admin's token for the target user's token, stashing the admin's own token under a separate localStorage key. A "Stop impersonating" item in the account menu restores the original admin session.
### Affected Area
Admin dashboard (user management), authentication (JWT issuance), and the frontend user/auth services.

Contributor guide

Open the contributing guide

Research direction

Start in AdminUserResource and trace the existing jwtToken(jwtClaims(user, ...)) login path before adding the admin-only impersonation endpoint. Then inspect the /dashboard/admin/user row actions and frontend user/auth services, including the account menu and localStorage session handling. Done means active users can be impersonated and the admin session can be restored, with the specified 404 and 400 responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
authentication, backend, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.