47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
namespace LaaProduction.Web.API
|
|
{
|
|
using LaaProduction.Personalization.Interfaces;
|
|
using LaaProduction.SharedModels;
|
|
using LaaProduction.Web.App_Infrastructure;
|
|
using LaaProductionDI;
|
|
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
|
|
[RoutePrefix("api/Login")]
|
|
public class LoginController : ApiController
|
|
{
|
|
private readonly IAccountManager accountManager;
|
|
|
|
public LoginController()
|
|
=> this.accountManager = LaaServiceProvider.GetService<IAccountManager>();
|
|
|
|
[HttpGet]
|
|
[AuthorizeBearer]
|
|
public IHttpActionResult Get()
|
|
{
|
|
var fullName = this.User.FullName();
|
|
|
|
return this.Content(HttpStatusCode.OK, fullName);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route(nameof(AD))]
|
|
public IHttpActionResult AD([FromBody] ADLoginModel model)
|
|
{
|
|
var bearer = this.accountManager.Login(model);
|
|
|
|
return this.Json(bearer);
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route(nameof(Local))]
|
|
public IHttpActionResult Local([FromBody] UserLoginModel model)
|
|
{
|
|
var bearer = this.accountManager.Login(model);
|
|
|
|
return this.Json(bearer);
|
|
}
|
|
}
|
|
}
|