mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using Govor.Application.Interfaces.Infrastructure.Extensions;
|
|
using Govor.Contracts.Requests;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Govor.API.Controllers.Authentication;
|
|
|
|
[RequireHttps]
|
|
[ApiController]
|
|
[Route("api/session")]
|
|
[Authorize(Roles = "Admin, User")]
|
|
public class SessionKeysController : Controller
|
|
{
|
|
private readonly ILogger<SessionKeysController> _logger;
|
|
private readonly ICurrentUserSessionService _currentSession;
|
|
private readonly ICurrentUserService _currentUser;
|
|
/*
|
|
[HttpPost("keys")]
|
|
public async Task<IActionResult> UploadSessionKeys([FromBody] UploadKeysRequest request)
|
|
{
|
|
var sessionId = _currentSession.GetUserSessionId();
|
|
|
|
await _sessionKeyService.AttachKeysAsync(sessionId, request.PublicEncryptionKey, request.PublicSigningKey);
|
|
|
|
return Ok();
|
|
}
|
|
|
|
[Authorize]
|
|
[HttpGet("users/{userId}/keys")]
|
|
public async Task<IActionResult> GetUserPublicKeys(Guid userId)
|
|
{
|
|
var requesterId = _currentUserService.UserId;
|
|
|
|
if (!await _friendshipService.AreFriendsAsync(requesterId, userId))
|
|
return Forbid("You can only access keys of your friends");
|
|
|
|
var keys = await _sessionKeyService.GetAllActiveKeysAsync(userId);
|
|
|
|
return Ok(keys);
|
|
}
|
|
|
|
*/
|
|
} |