diff --git a/Endpoint/Controllers/V1/AuthController.cs b/Endpoint/Controllers/V1/AuthController.cs index 86b6fd7..dcd1821 100644 --- a/Endpoint/Controllers/V1/AuthController.cs +++ b/Endpoint/Controllers/V1/AuthController.cs @@ -60,6 +60,12 @@ public class AuthController(IOptionsSnapshot user, AuthService auth, Pass [ApiExplorerSettings(IgnoreApi = true)] public void OnActionExecuted(ActionExecutedContext context) { } + /// + /// Handles user authentication by verifying the username/email and password, + /// then generating and returning an authentication token if successful. + /// + /// The login request containing the username/email and password. + /// A TokenResponse containing the access token and its expiry if successful, otherwise an Unauthorized response. [HttpPost("Login")] [ProducesResponseType(StatusCodes.Status401Unauthorized)] public async Task> Login([FromBody] LoginRequest request) @@ -87,6 +93,10 @@ public class AuthController(IOptionsSnapshot user, AuthService auth, Pass }); } + /// + /// Refreshes the authentication token using the existing refresh token. + /// + /// A TokenResponse containing the new access token and its expiry if successful, otherwise an Unauthorized response. [HttpGet("ReLogin")] [ProducesResponseType(StatusCodes.Status401Unauthorized)] public async Task> ReLogin() @@ -120,6 +130,10 @@ public class AuthController(IOptionsSnapshot user, AuthService auth, Pass } } + /// + /// Logs the user out by clearing the refresh token and performing any necessary cleanup. + /// + /// An Ok response if the logout was successful. [HttpGet("Logout")] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [Authorize] @@ -133,6 +147,10 @@ public class AuthController(IOptionsSnapshot user, AuthService auth, Pass return Ok(); } + /// + /// Retrieves the role of the authenticated user. + /// + /// The role of the authenticated user. [HttpGet("GetRole")] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [Authorize]