Added basic auth checking code. First bit of code to protect an API call in the Employee controller.

This commit is contained in:
2021-01-03 18:44:08 -06:00
parent 26ea8e8cbc
commit ddb42da7bb
15 changed files with 670 additions and 15 deletions
+8 -2
View File
@@ -25,13 +25,19 @@ namespace SecureCore.Controllers
[HttpGet]
public IActionResult Get()
{
return Ok(DataService.Get());
if (Authentication.IsAllowed(HttpContext))
return Ok(DataService.Get());
else
return Unauthorized();
}
[HttpGet("{id}", Name = "Get")]
public IActionResult Get(int id)
{
return Ok(DataService.GetById(id));
if (Authentication.IsAllowed(HttpContext))
return Ok(DataService.GetById(id));
else
return Unauthorized();
}
}