-
User Self-Service Endpoints (SZ-38)
Sztab provides authenticated users with basic self-service account management. These endpoints work under session-auth, using the currently logged-in user from the
SecurityContextHolder.Get Current User
GET /api/users/meReturns the profile of the authenticated user.
Example response:
200 OK { "id": 1, "username": "admin", "email": "admin@example.com", "fullName": "Administrator", "mustChangePassword": false }
Update Own Profile
PUT /api/users/meAllows the user to update email and full name.
Example request:
{ "email": "new@example.com", "fullName": "New Name" }
Example response:
200 OK { "id": 1, "username": "admin", "email": "new@example.com", "fullName": "New Name" }
Change Password
POST /api/users/change-passwordAllows the authenticated user to change their password using a secure, two-field request.
Example request:
{ "oldPassword": "current123", "newPassword": "newSecureP@ss" }
Successful response:
200 OK { "message": "Password changed successfully" }
Error response (wrong old password):
400 Bad Request { "error": "Invalid old password" }
OpenAPI Additions
/api/users/me: get: summary: Get current authenticated user's profile security: - sessionAuth: [] responses: '200': description: User profile put: summary: Update current user's profile security: - sessionAuth: [] requestBody: required: true responses: '200': description: Updated user profile /api/users/change-password: post: summary: Change current user's password security: - sessionAuth: [] requestBody: required: true responses: '200': description: Password updated successfully '400': description: Invalid old password -
| Type |
New Feature
|
| Priority |
Normal
|
| Assignee | |
| Version |
1.0
|
| Sprints |
n/a
|
| Customer |
n/a
|
Description
The current Sztab backend supports full admin-level user CRUD but lacks self-service endpoints for logged-in users.
This task introduces minimal extensions to enable user autonomy while preserving admin control.
Scope
Userentity with amustChangePasswordflag (defaultfalse).GET /api/users/me— fetch logged-in user profile.PUT /api/users/me— update own profile (name, email).POST /api/users/change-password— securely change password.PasswordChangeRequestDTO.Notes
These endpoints operate under session-auth, authenticated via the current user’s context (
SecurityContextHolder).No new roles or permissions introduced; access is restricted to authenticated sessions only.
Deliverables
UserControllerTestto include/meand/change-password.