aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Controllers/AuthController.cs
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-03-09 22:27:02 +0100
committerSonja Galovic <galovicsonja@gmail.com>2022-03-09 22:27:02 +0100
commita6f994c8bcd6949c186fe4209ad5a5f5f9f58eb5 (patch)
treebfd8bdbde15f033bb4229eb6095d92ecacf3e5da /backend/api/api/Controllers/AuthController.cs
parent04b1d70fb48093608cc8084fff82cb319fa0becd (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.cs14
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");
+ }
+
}
}