29 lines
681 B
C#
29 lines
681 B
C#
using ldap_cesi.Services.Interfaces;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ldap_cesi.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("/api/jwt")]
|
|
public class JwtController : ControllerBase
|
|
{
|
|
private readonly IJwtService _jwtService;
|
|
|
|
public JwtController(IJwtService jwtService)
|
|
{
|
|
_jwtService = jwtService;
|
|
}
|
|
|
|
[HttpGet("public-key")]
|
|
public IActionResult GetPublicKey()
|
|
{
|
|
var publicKey = _jwtService.GetPublicKey();
|
|
if (string.IsNullOrEmpty(publicKey))
|
|
{
|
|
return BadRequest("Impossible de récupérer la clé publique");
|
|
}
|
|
|
|
return Ok(publicKey);
|
|
}
|
|
} |