Class: AuthController
Defined in: packages/web-backend/src/auth/auth.controller.ts:15
Controller for authentication endpoints. Provides token issuance and credential verification APIs.
Constructors
Constructor
new AuthController(
authService):AuthController
Defined in: packages/web-backend/src/auth/auth.controller.ts:20
Construct the controller with the authentication service.
Parameters
authService
Service handling user auth and JWT issuance.
Returns
AuthController
Methods
loginUser()
loginUser(
req):Promise<{token:string; }>
Defined in: packages/web-backend/src/auth/auth.controller.ts:37
Handles user login and returns a JWT token.
Parameters
req
Express request object. See https://expressjs.com/en/api.html#req.
user
Returns
Promise<{ token: string; }>
JWT token
Examples
Request body sample:
{
"username": "Ed",
"password": "WinryRockbell"
}POST request: https://staging.app.openpra.org/api/auth/token-obtainverifyPassword()
verifyPassword(
body):Promise<{match:boolean; }>
Defined in: packages/web-backend/src/auth/auth.controller.ts:54
Verifies if the provided password matches the database for the given user.
Parameters
body
The request should contain two keys: username and password.
password
string
username
string
Returns
Promise<{ match: boolean; }>
Whether the provided password matches for the given username.
Example
Request body example:
{
"username": "Ed",
"password": "FullMetalAlchemist"
}