Overview
Session management endpoints allow frontend applications to check authentication state and retrieve user session information. These endpoints are exposed by thesgivu-gateway BFF (Backend-for-Frontend).
Base URL
Get Session Status
Response
Subject identifier (username)
Full name of the authenticated user
Email address of the authenticated user
Array of role names assigned to the user
Array of permission strings (e.g.,
user:read, vehicle:create)Combined array of roles and permissions for authorization checks
Token issued at timestamp (Unix epoch)
Token expiration timestamp (Unix epoch)
Status Codes
200 OK- Session information retrieved successfully401 Unauthorized- Not authenticated or token expired
Example
Validate Credentials
application/json
Request Body
Username to validate
Password to validate
Response
Indicates whether the credentials are valid
If
valid is false, provides the reason for validation failure. Possible values:invalid_credentials- Username or password is incorrectdisabled- User account is disabledlocked- User account is lockedexpired- User account has expiredcredentials- Credentials have expiredservice_unavailable- User service is unreachable
null if valid is trueSuccess Response
Failure Response
Status Codes
200 OK- Validation completed (checkvalidfield for result)400 Bad Request- Malformed request or missing required fields500 Internal Server Error- Server error during validation
Example
Logout
Response
Redirects to the login page or application home page.Example
Session Storage
SGIVU uses Spring Session with JDBC for session persistence:- Sessions are stored in PostgreSQL (
SPRING_SESSIONtables) - Sessions survive application restarts
- Supports distributed deployments with session sharing
Session Configuration
- Session timeout: Configurable via Spring Session settings
- Cookie name:
SESSION - Cookie attributes: HttpOnly, Secure (in production), SameSite=Lax
Security Notes
Internal Service Authentication
The credentials validation endpoint uses theX-Internal-Service-Key header for communication between sgivu-auth and sgivu-user:
JWT Claims
The session endpoint exposes claims from the JWT token including:- Standard claims:
sub,iat,exp,iss,aud - Custom claims:
rolesAndPermissions- used for authorization
Authorization Headers
The gateway propagates user information to downstream services via headers:X-User-ID: User ID from the tokenX-Username: Username from the tokenAuthorization: Bearer token for resource server validation