source: iknow-api/Models/User.cs@ 4f5d8fd

Last change on this file since 4f5d8fd was 5eb7847, checked in by stefansaveski <stefansaveski19@…>, 11 months ago

Add JWT authentication and refactor namespaces

Introduced JWT-based authentication and authorization:

  • Configured JWT authentication in Program.cs with token validation.
  • Added [Authorize] attribute to a new getstring endpoint.

Refactored namespaces for consistency:

  • Updated namespaces from iknow_api.Core.* to iknow_api.*.

Enhanced middleware and dependency injection:

  • Registered IAuthService and IUserRepository.
  • Added app.UseAuthentication() and app.UseAuthorization().

Removed unused code and dependencies:

  • Deleted WeatherForecast class.
  • Cleaned up redundant imports.

Updated project dependencies to include JWT authentication library.

  • Property mode set to 100644
File size: 548 bytes
RevLine 
[618be76]1
2
[5eb7847]3namespace iknow_api.Models
[618be76]4{
5 public enum UserRole
6 {
7 Admin,
8 Professor,
9 Strudent
10 }
11
[9694de9]12 public class User
[618be76]13 {
14 public int Id { get; set; }
15 public string? Name { get; set; }
16 public string? Surname { get; set; }
17 public string? Index { get; set; }
18 public string? Email { get; set; }
[fc7b4b4]19 public string? PasswordHash { get; set; }
[618be76]20 public DateTime Bday { get; set; }
21 public DateTime CreatedAt { get; set; }
22 public UserRole Role { get; set; }
23 }
24}
Note: See TracBrowser for help on using the repository browser.