Moved the authentication code to its own dedicated class. Minor code cleanup.

This commit is contained in:
2021-01-02 15:31:52 -08:00
parent a955fc5346
commit e8454fb652
11 changed files with 90 additions and 57 deletions
+22
View File
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SecureCore.Controllers
{
[Route("[controller]")]
[ApiController]
public class AuthController : Controller
{
[HttpPost("login")]
[AcceptVerbs("POST")]
public IActionResult Login(LoginInfo info)
{
var (hash, salt) = Authentication.HashPassword(info.Password);
return Ok($"Session Key: {Authentication.CreateSessionId()}{Environment.NewLine}Password Hash: {hash}{Environment.NewLine}Salt: {salt}{Environment.NewLine}");
}
}
}