53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using SecureCore.Services;
|
|
using System.Security.Cryptography;
|
|
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
|
|
|
namespace SecureCore.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class EmployeeController : Controller
|
|
{
|
|
private readonly IDataService DataService;
|
|
|
|
|
|
public EmployeeController(IDataService dataService)
|
|
{
|
|
DataService = dataService;
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult Get()
|
|
{
|
|
return Ok(DataService.Get());
|
|
}
|
|
|
|
[HttpGet("{id}", Name = "Get")]
|
|
public IActionResult Get(int id)
|
|
{
|
|
return Ok(DataService.GetById(id));
|
|
}
|
|
|
|
//[HttpPost("login")]
|
|
//[AcceptVerbs("POST")]
|
|
//public IActionResult Login(LoginInfo info)
|
|
//{
|
|
// var (Hash, Salt) = Auth.HashPassword(info.Password);
|
|
|
|
// return Ok($"Session Key: {Auth.CreateSessionId()}{Environment.NewLine}Password Hash: {Hash}{Environment.NewLine}Salt: {Salt}{Environment.NewLine}");
|
|
//}
|
|
}
|
|
|
|
public class AuthenticatedUser
|
|
{
|
|
public string UserName { get; set; }
|
|
public string SessionToken { get; set; }
|
|
}
|
|
}
|