Moved the authentication code to its own dedicated class. Minor code cleanup.
This commit is contained in:
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user