This commit is contained in:
Artemy
2025-06-27 21:50:23 +07:00
parent 05298c004c
commit 26dc4ccc1f
6 changed files with 302 additions and 155 deletions
+1 -5
View File
@@ -58,11 +58,6 @@ public class ChatsHub : Hub
}
var senderId = GetUserId();
if (senderId == Guid.Empty)
{
_logger.LogError("Could not retrieve sender userId");
throw new InvalidOperationException("User not authenticated");
}
// Проверка существования получателя
try
@@ -100,6 +95,7 @@ public class ChatsHub : Hub
var userIdClaim = Context.User?.FindFirst("userID")?.Value;
if (string.IsNullOrEmpty(userIdClaim) || !Guid.TryParse(userIdClaim, out var userId))
{
_logger.LogError("Could not retrieve sender userId");
throw new UnauthorizedAccessException("userID claim is missing or invalid");
}
return userId;