Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Yurben-bit/Sistema-de-Administraci-n-Escolar-Backend/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheLoginRequest class is a Data Transfer Object (DTO) used to encapsulate user credentials during the authentication process. It provides a clean way to transfer login data from the client to the authentication endpoint.
Purpose
This DTO is specifically designed for:- Receiving login credentials from client applications
- Validating user authentication requests
- Decoupling the API layer from the persistence layer
- Providing a type-safe contract for login operations
Fields
The username credential for authentication. This should match a unique username in the User model.Usage: Identifies the user attempting to log in
The password credential for authentication. Should be sent as plain text over HTTPS and will be validated against the hashed password in the database.Usage: Verifies the user’s identity
Methods
Constructor
LoginRequest()
- No-argument constructor
- Required by Spring Framework for object instantiation during request deserialization
- Allows Spring to create an empty object and populate it using setters
Getters and Setters
String getUsername()
- Returns the username field value
- Used by the authentication service to retrieve the username
void setUsername(String username)
- Sets the username field value
- Called by Spring during JSON deserialization
String getPassword()
- Returns the password field value
- Used by the authentication service to retrieve the password
void setPassword(String password)
- Sets the password field value
- Called by Spring during JSON deserialization
Used By
This DTO is used by the following endpoints:- POST /auth/login - Main authentication endpoint that accepts LoginRequest and returns a JWT token
JSON Format
When sending a login request, the JSON payload should follow this structure:Usage Example
Client-Side Request
Server-Side Usage
Related Models
- User Model - The JPA entity used to validate credentials
Related Endpoints
- POST /auth/login - Authenticates users using this DTO
Source Code
Design Pattern
This class follows the Data Transfer Object (DTO) pattern, which:- Separates API contracts from domain models
- Reduces coupling between layers
- Provides flexibility to change internal models without affecting the API
- Improves security by limiting exposed data
Why Not Use Lombok?
Unlike the User model, this DTO uses traditional getters and setters instead of Lombok annotations. This approach:- Makes the code more explicit and readable for simple DTOs
- Avoids additional dependencies for straightforward classes
- Provides clear visibility of all methods
- Is suitable for classes with minimal fields