Ignore:
Timestamp:
12/21/25 18:15:59 (9 months ago)
Author:
Stefan-Saveski <stefansaveski19@…>
Branches:
master
Children:
97a2322
Parents:
2e17229
Message:

Added dockerfile and changes to GET user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/Program.cs

    r2e17229 rbf18ca4  
    99
    1010var builder = WebApplication.CreateBuilder(args);
     11
     12// Add CORS policy
     13builder.Services.AddCors(options =>
     14{
     15    options.AddPolicy("AllowFrontend", policy =>
     16    {
     17        var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>()
     18            ?? new[] { "http://localhost:3000" };
     19       
     20        policy.WithOrigins(allowedOrigins) // Your frontend URL(s)
     21              .AllowAnyHeader()
     22              .AllowAnyMethod()
     23              .AllowCredentials();
     24    });
     25});
     26
    1127builder.Services.AddAuthentication(options =>
    1228{
     
    6480}
    6581
     82// Enable CORS - must be called before UseAuthentication and UseAuthorization
     83app.UseCors("AllowFrontend");
     84
    6685app.UseHttpsRedirection();
    6786app.UseAuthentication(); // <-- must come BEFORE UseAuthorization
Note: See TracChangeset for help on using the changeset viewer.