Add a property to retrieve the claims (id and login) in the token

This commit is contained in:
Sébastien André
2020-03-20 19:34:27 +01:00
parent 7bad7e80d5
commit c15ad54823
11 changed files with 44 additions and 12 deletions

View File

@@ -10,13 +10,15 @@ using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.DataContract;
using skydiveLogs_api.Model;
using System.Linq;
using System.Security.Claims;
namespace skydiveLogs_api.Controllers
{
[Route("api/[controller]")]
[ApiController]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
public class JumpController : ControllerBase
public class JumpController : Base
{
public JumpController(IJumpService jumpService,
IMapper mapper)
@@ -30,8 +32,7 @@ namespace skydiveLogs_api.Controllers
[EnableCors]
public IEnumerable<JumpResp> Get()
{
var connectedUser = new User() { Id = 1 }; // TEST
var result = _jumpService.GetAllJumps(connectedUser);
var result = _jumpService.GetAllJumps(ConnectedUser);
return _mapper.Map<IEnumerable<JumpResp>>(result);
}
@@ -55,7 +56,7 @@ namespace skydiveLogs_api.Controllers
value.JumpTypeId,
value.GearId,
_mapper.Map<Jump>(value),
null /* Provenant du token */);
ConnectedUser);
}
// PUT: api/Jump/5