docs: add comment

This commit is contained in:
Polianin Nikita 2024-11-04 03:14:42 +03:00
parent 95627003e5
commit 503f5792fb

View File

@ -29,12 +29,21 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
Path = UrlHelper.GetSubPathWithoutFirstApiName + "api" Path = UrlHelper.GetSubPathWithoutFirstApiName + "api"
}; };
/// <summary>
/// Gets the list of available OAuth providers with their respective redirect URIs.
/// </summary>
/// <returns>A list of available providers.</returns>
[HttpGet("GetAvailableProviders")] [HttpGet("GetAvailableProviders")]
public ActionResult<List<AvailableProvidersResponse>> GetUrls() => public ActionResult<List<AvailableProvidersResponse>> GetUrls() =>
Ok(oAuthService Ok(oAuthService
.GetAvailableProviders(HttpContext, GetCookieParams(), HttpContext.GetApiUrl(Url.Action("OAuth2")!)) .GetAvailableProviders(HttpContext, GetCookieParams(), HttpContext.GetApiUrl(Url.Action("OAuth2")!))
.ConvertToDto()); .ConvertToDto());
/// <summary>
/// Logs in a user using their username or email and password.
/// </summary>
/// <param name="request">The login request containing username/email and password.</param>
/// <returns>A TwoFactorAuthentication token if the login is successful; otherwise, a BadRequest response.</returns>
[HttpPost("Login")] [HttpPost("Login")]
[BadRequestResponse] [BadRequestResponse]
public async Task<ActionResult<TwoFactorAuthentication>> Login([FromBody] LoginRequest request) public async Task<ActionResult<TwoFactorAuthentication>> Login([FromBody] LoginRequest request)
@ -63,6 +72,11 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
return Ok(tokenResult.ConvertToDto()); return Ok(tokenResult.ConvertToDto());
} }
/// <summary>
/// Performs two-factor authentication for the user.
/// </summary>
/// <param name="request">The request containing the method and code for two-factor authentication.</param>
/// <returns>A boolean indicating whether the two-factor authentication was successful.</returns>
[HttpPost("2FA")] [HttpPost("2FA")]
[BadRequestResponse] [BadRequestResponse]
public async Task<ActionResult<bool>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request) public async Task<ActionResult<bool>> TwoFactorAuth([FromBody] TwoFactorAuthRequest request)