diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-09 22:27:02 +0100 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-09 22:27:02 +0100 |
commit | a6f994c8bcd6949c186fe4209ad5a5f5f9f58eb5 (patch) | |
tree | bfd8bdbde15f033bb4229eb6095d92ecacf3e5da /backend/api/api/Controllers/AuthController.cs | |
parent | 04b1d70fb48093608cc8084fff82cb319fa0becd (diff) |
Komponenta za ucitavanje i prikaz csv fajla v2
Diffstat (limited to 'backend/api/api/Controllers/AuthController.cs')
-rw-r--r-- | backend/api/api/Controllers/AuthController.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/backend/api/api/Controllers/AuthController.cs b/backend/api/api/Controllers/AuthController.cs index 1f47067f..c74c579d 100644 --- a/backend/api/api/Controllers/AuthController.cs +++ b/backend/api/api/Controllers/AuthController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using api.Services; +using Microsoft.AspNetCore.Authorization; namespace api.Controllers { @@ -9,10 +10,10 @@ namespace api.Controllers [ApiController] public class AuthController : ControllerBase { - private AuthService _auth; - public AuthController(IConfiguration configuration) + private IAuthService _auth; + public AuthController(IAuthService auth) { - _auth=new AuthService(configuration); + _auth = auth; } [HttpPost("register")] @@ -29,6 +30,13 @@ namespace api.Controllers return Ok(_auth.Login(user)); } + [HttpGet("Auth")] + [Authorize(Roles ="User")] + public async Task<ActionResult<string>> TestAuth() + { + return Ok("works"); + } + } } |