diff options
author | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-11-04 23:33:50 +0100 |
---|---|---|
committer | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-11-04 23:33:50 +0100 |
commit | bbd8255288db31f4473b000aab2dfbe3d7fb0f38 (patch) | |
tree | ef7852927037e601ada10e91d5b9348b3ed7c267 /Backend/Api/Api/Controllers/AuthController.cs | |
parent | 93f3ab2aa55a57000cdff1cddf4955b5329978b0 (diff) |
Napravljen controller za refreshJwt-a na backu.
Diffstat (limited to 'Backend/Api/Api/Controllers/AuthController.cs')
-rw-r--r-- | Backend/Api/Api/Controllers/AuthController.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Backend/Api/Api/Controllers/AuthController.cs b/Backend/Api/Api/Controllers/AuthController.cs index cbd5eb8..abb7adc 100644 --- a/Backend/Api/Api/Controllers/AuthController.cs +++ b/Backend/Api/Api/Controllers/AuthController.cs @@ -37,6 +37,17 @@ namespace Api.Controllers return Ok(); } + [HttpPost("refreshJwt")] + [Authorize(Roles ="User")] + public async Task<ActionResult<string>> refreshJwt() + { + var jwt = await _userService.RenewToken(); + if (jwt != null) + { + return Ok(jwt); + } + return BadRequest("Pogresno uneti podaci"); + } [HttpPost("login")] public async Task<ActionResult<string>> Login([FromBody] Login creds) { |