Ignore:
Timestamp:
10/22/25 22:40:03 (11 months ago)
Author:
stefansaveski <stefansaveski19@…>
Branches:
master
Children:
41e4f9f
Parents:
d025ba3
Message:

Implement JWT Authentication and Update User Schema

Replaced repository interface with FinXaccesApi.Repositories in UsersControllers.cs. Updated database schema to use PasswordHash instead of Password. Added new migration files reflecting these changes. Updated service registration in Program.cs to include IAuthService and IUserRepository. Refactored UserRepository.cs and IUserRepository.cs with new methods and namespace changes. Commented out UserService.cs. Updated appsettings with new connection strings and JWT settings. Added BCrypt.Net-Next and System.IdentityModel.Tokens.Jwt packages. Introduced AuthController, UserDTO, AuthService, and IAuthService for handling authentication and user management.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/Program.cs

    rd025ba3 r5b42c8d  
    11using Microsoft.EntityFrameworkCore;
    22using iknow_api.Core.Data;
     3using FinXaccesApi.Services;
     4using FinXaccesApi.Repositories;
    35
    46var builder = WebApplication.CreateBuilder(args);
    57
    68// Add services to the container.
    7 
    89builder.Services.AddControllers();
    9 // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
    1010builder.Services.AddOpenApi();
    1111
    12 
     12// Register DbContext
    1313builder.Services.AddDbContext<AppDbContext>(options =>
    1414    options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
    1515
    16 builder.Services.AddScoped<iknow_api.Repository.Interfaces.IUserRepository, iknow_api.Repository.UserRepository>();
     16// Register your services
     17builder.Services.AddScoped<IAuthService, AuthService>();
     18builder.Services.AddScoped<IUserRepository, UserRepository>(); // You'll need to add the UserRepository implementation
    1719
    1820var app = builder.Build();
     
    2426}
    2527
    26 builder.Services.AddDbContext<AppDbContext>(options =>
    27     options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
    28 
    29    
    3028app.UseHttpsRedirection();
    31 
    3229app.UseAuthorization();
    33 
    3430app.MapControllers();
    3531
Note: See TracChangeset for help on using the changeset viewer.