PlataformaEduca enforces security at two levels: authentication (is the request from a known user?) and authorization (does that user have the right role?). Both are handled via JSON Web Tokens — no server-side sessions are created or maintained.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/miagv/PlataformaEduca/llms.txt
Use this file to discover all available pages before exploring further.
How tokens work
Tokens are issued by the/api/auth/login endpoint and follow the JWT standard:
- Algorithm: HS256 (HMAC-SHA256)
- Subject claim: the user’s email address
- Custom claim:
roles— an array of role strings, e.g.["ROLE_DOCENTE"] - Validity: 24 hours (86400000 ms) from the time of issue, configured via
jwt.expiration - Secret: the value of
jwt.secretinapplication.properties; must be at least 32 characters
Token validation
Every incoming request passes throughJwtFilter, which extends Spring’s OncePerRequestFilter. The filter:
- Checks whether the request path is on the public allowlist (see below). If so, the filter skips validation entirely.
- Reads the
Authorizationheader and extracts the Bearer token. - Validates the signature and expiry using the configured secret.
- If valid, loads the user’s authorities from the token’s
rolesclaim and sets theSecurityContext. - If invalid or missing, the request continues unauthenticated and Spring Security returns
401for any protected route.
Session policy
HTTP sessions are disabled:Authorization header alone.
Passwords
User passwords are stored as BCrypt hashes. Plain-text passwords are never persisted. BCrypt hashing is applied automatically at registration time.Route protection
| Route pattern | Access level |
|---|---|
/api/auth/register | Public — no token required |
/api/auth/login | Public — no token required |
/swagger-ui/** | Public |
/v3/api-docs/** | Public |
/api/cursos/** | Any authenticated user |
/api/notas/** | Any authenticated user |
/api/coordinador/** | COORDINADOR role only |
/api/docente/** | DOCENTE role only |
/api/estudiante/** | ESTUDIANTE role only |
“Any authenticated user” means a valid, unexpired token is required — regardless of role. A DOCENTE token grants access to
/api/cursos/** but not to /api/coordinador/**.How to include the token in requests
Pass the token in theAuthorization header on every protected request:
Authorization: Bearer <token> — including the word Bearer followed by a single space.
Error responses
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
Returned when the token is valid but the user’s role does not satisfy the access requirement for the requested route. For example, a user with
ROLE_ESTUDIANTE calling /api/coordinador/** will receive a 403.Security configuration summary
| Setting | Value |
|---|---|
| Signing algorithm | HS256 |
| Token lifetime | 86400000 ms (24 hours) |
| Session policy | STATELESS |
| CSRF | Disabled |
| Password storage | BCrypt |
| Filter class | JwtFilter (OncePerRequestFilter) |