From 41b5bb571b7b2c3b98e20a6cda6d0e8fb2cd716f Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Fri, 28 Jun 2024 22:55:18 +0300 Subject: [PATCH] docs: add xml comments --- Endpoint/Controllers/V1/AuthController.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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]