refactor(JWT): Ungenutzte Schnittstelle und Controller entfernt
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/test/[controller]")]
|
||||
public class TestAuthController : ControllerBase
|
||||
{
|
||||
private readonly IJWTService<string> _authService;
|
||||
|
||||
public TestAuthController(IJWTService<string> authService)
|
||||
{
|
||||
_authService = authService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult ProvideToken([FromQuery] string value)
|
||||
{
|
||||
var token = _authService.GenerateToken(value);
|
||||
return Ok(token);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetSecurityToken([FromQuery] string token)
|
||||
{
|
||||
var sToken = _authService.ReadSecurityToken(token);
|
||||
return Ok(sToken);
|
||||
}
|
||||
|
||||
[HttpGet("Username")]
|
||||
[Authorize]
|
||||
public IActionResult Getname()
|
||||
{
|
||||
var username = User.Claims?.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
|
||||
return Ok(username);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user