Beging to add the authorization with a JWT token
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
using AutoMapper;
|
||||
|
||||
@@ -13,6 +15,7 @@ namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
public class JumpController : ControllerBase
|
||||
{
|
||||
public JumpController(IJumpService jumpService,
|
||||
@@ -27,7 +30,9 @@ namespace skydiveLogs_api.Controllers
|
||||
[EnableCors]
|
||||
public IEnumerable<JumpResp> Get()
|
||||
{
|
||||
var result = _jumpService.GetAllJumps();
|
||||
var connectedUser = new User() { Id = 1 }; // TEST
|
||||
var result = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return _mapper.Map<IEnumerable<JumpResp>>(result);
|
||||
}
|
||||
|
||||
@@ -49,7 +54,8 @@ namespace skydiveLogs_api.Controllers
|
||||
value.DropZoneId,
|
||||
value.JumpTypeId,
|
||||
value.GearId,
|
||||
_mapper.Map<Jump>(value));
|
||||
_mapper.Map<Jump>(value),
|
||||
null /* Provenant du token */);
|
||||
}
|
||||
|
||||
// PUT: api/Jump/5
|
||||
|
||||
Reference in New Issue
Block a user