feat: add available providers list

This commit is contained in:
2024-11-04 02:59:51 +03:00
parent 5f36e0f75b
commit a96073d44d
4 changed files with 81 additions and 0 deletions

View File

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Mirea.Api.Dto.Common;
using Mirea.Api.Dto.Requests;
using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes;
using Mirea.Api.Endpoint.Common.Exceptions;
using Mirea.Api.Endpoint.Common.MapperDto;
@ -28,6 +29,12 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
Path = UrlHelper.GetSubPathWithoutFirstApiName + "api"
};
[HttpGet("GetAvailableProviders")]
public ActionResult<List<AvailableProvidersResponse>> GetUrls() =>
Ok(oAuthService
.GetAvailableProviders(HttpContext, GetCookieParams(), HttpContext.GetApiUrl(Url.Action("OAuth2")!))
.ConvertToDto());
[HttpPost("Login")]
[BadRequestResponse]
public async Task<ActionResult<TwoFactorAuthentication>> Login([FromBody] LoginRequest request)