baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers
|
||||
{
|
||||
[EnableCors("any")]
|
||||
public class AuthenticationController : Controller
|
||||
{
|
||||
private readonly IAuthenticateService _authService;
|
||||
public AuthenticationController(IAuthenticateService authService)
|
||||
{
|
||||
this._authService = authService;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public ActionResult RequestToken([FromBody] LoginRequest request)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest("Invalid Request");
|
||||
}
|
||||
string token;
|
||||
if (_authService.IsAuthenticated(request, out token))
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new {request.UserName, request.errtype, token } });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token = "" } });
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public ActionResult FaceRequestToken([FromBody] LoginRequest request)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest("Invalid Request");
|
||||
}
|
||||
string token;
|
||||
if (_authService.IsAuthenticated(request, out token))
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token } });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token = "" } });
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return Ok("AuthenticationController");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user