mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 23:34:10 +02:00
feat: Refactor authentication and token management
- Updated EchoHubConnection to use ApiClient for token retrieval. - Introduced ValidationConstants for common validation patterns and limits. - Enhanced AuthDtos with refresh token support and expiration details. - Added new ChatDtos for channel creation and topic updates. - Created CommonDtos for error and paginated responses. - Implemented RefreshToken model for managing refresh tokens. - Modified JwtTokenService to generate and hash refresh tokens. - Updated AuthController to handle registration, login, token refresh, and logout with improved error handling. - Enhanced ChannelsController with channel creation, topic updates, and pagination for channel retrieval. - Added FilesController for file management with rate limiting. - Improved UsersController for profile updates and avatar uploads with validation. - Integrated rate limiting across controllers to manage request load. - Introduced FileValidationHelper for validating uploaded image files. - Updated database context to include RefreshToken and enforce unique constraints. - Enhanced ChatHub for improved channel and message handling with validation. - Updated Program.cs to configure rate limiting and CORS policies.
This commit is contained in:
@@ -4,4 +4,12 @@ public record RegisterRequest(string Username, string Password, string? DisplayN
|
||||
|
||||
public record LoginRequest(string Username, string Password);
|
||||
|
||||
public record LoginResponse(string Token, string Username, string? DisplayName, string? NicknameColor);
|
||||
public record LoginResponse(
|
||||
string Token,
|
||||
string RefreshToken,
|
||||
DateTimeOffset ExpiresAt,
|
||||
string Username,
|
||||
string? DisplayName,
|
||||
string? NicknameColor);
|
||||
|
||||
public record RefreshRequest(string RefreshToken);
|
||||
|
||||
@@ -29,3 +29,7 @@ public record UserDto(
|
||||
DateTimeOffset LastSeenAt);
|
||||
|
||||
public record SendMessageRequest(string ChannelName, string Content);
|
||||
|
||||
public record CreateChannelRequest(string Name, string? Topic = null);
|
||||
|
||||
public record UpdateTopicRequest(string? Topic);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace EchoHub.Core.DTOs;
|
||||
|
||||
public record ErrorResponse(string Error, string? Detail = null);
|
||||
|
||||
public record PaginatedResponse<T>(List<T> Items, int Total, int Offset, int Limit);
|
||||
@@ -29,3 +29,5 @@ public record UserPresenceDto(
|
||||
string? NicknameColor,
|
||||
UserStatus Status,
|
||||
string? StatusMessage);
|
||||
|
||||
public record AvatarUploadResponse(string AvatarAscii);
|
||||
|
||||
Reference in New Issue
Block a user