Skip to main content
POST
Login
The login endpoint authenticates a user and returns a JWT (JSON Web Token) that can be used for subsequent authenticated requests. The token is generated using the HS256 signing algorithm and is valid for 10 hours from the time of issuance.

Implementation Details

The endpoint is implemented in AuthController.java:16 and uses the JwtService to generate tokens. The JWT includes:
  • Subject: The username
  • Issued At: Current timestamp
  • Expiration: 10 hours from issuance (36,000,000 milliseconds)
  • Signature Algorithm: HS256

Request Body

string
required
The username for authentication. This will be set as the subject claim in the JWT token.
string
required
The user’s password for authentication.

Response

string
A JWT token string that can be used for authenticating subsequent API requests. The token expires 10 hours after generation.

Success Response

Status Code: 200 OK The endpoint returns a plain string containing the JWT token.

Example Request

Example Response

Code Reference

The login controller (AuthController.java:16-18):
Token generation logic (JwtService.java:19-27):

Notes

  • The current implementation does not validate the password against a database
  • The token expiration is set to 10 hours (configurable in JwtService.java:23)
  • The endpoint logs authentication attempts to the console