fix: update package versions for EntityFramework and adjust API endpoint in login component

This commit is contained in:
Marek Lesko
2025-07-30 08:05:36 +02:00
parent 329fb94a3a
commit af127b716e
4 changed files with 9 additions and 10 deletions

View File

@@ -12,11 +12,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.18" NoWarn="NU1605" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.18" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.18" NoWarn="NU1605" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.18" NoWarn="NU1605" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.18">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.18" />
<PackageReference Include="Microsoft.Identity.Web" Version="3.10.0" /> <PackageReference Include="Microsoft.Identity.Web" Version="3.10.0" />
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="3.10.0" /> <PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="3.10.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />

View File

@@ -6,8 +6,8 @@ using Microsoft.AspNetCore.Authorization;
namespace Api.Controllers namespace Api.Controllers
{ {
[ApiController] [ApiController]
[Authorize] //[Authorize]
[Route("api/[controller]")] [Route("api/product")]
public class ProductController : ControllerBase public class ProductController : ControllerBase
{ {
private readonly AppDbContext _context; private readonly AppDbContext _context;
@@ -19,7 +19,6 @@ namespace Api.Controllers
// GET: api/Product // GET: api/Product
[HttpGet] [HttpGet]
[Route("api/product")]
public async Task<ActionResult<IEnumerable<Product>>> GetProducts([FromQuery] int? id = null) public async Task<ActionResult<IEnumerable<Product>>> GetProducts([FromQuery] int? id = null)
{ {
if (id.HasValue) if (id.HasValue)

View File

@@ -31,8 +31,8 @@ namespace Api
options.Authority = builder.Configuration["Authentication:PocketId:Authority"]; options.Authority = builder.Configuration["Authentication:PocketId:Authority"];
options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters() options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
{ {
ValidAudiences = builder.Configuration["Authentication:PocketId:ClientId"].Split(';').Select(i => i.Trim()).ToArray(), ValidAudiences = builder.Configuration["Authentication:PocketId:ClientId"]?.Split(';').Select(i => i.Trim()).ToArray(),
ValidIssuers = builder.Configuration["Authentication:PocketId:Authority"].Split(';').Select(i => i.Trim()).ToArray() ValidIssuers = builder.Configuration["Authentication:PocketId:Authority"]?.Split(';').Select(i => i.Trim()).ToArray()
}; };
}); });

View File

@@ -13,7 +13,7 @@ export class Login implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.httpClient.get('http://localhost:5000/swagger/v1/swagger.json', { this.httpClient.get('https://localhost:5001/api/product', {
headers: new HttpHeaders({ Authorization: `Bearer ${this.as.getAccessToken()}` }).append('Content-Type', 'application/json') headers: new HttpHeaders({ Authorization: `Bearer ${this.as.getAccessToken()}` }).append('Content-Type', 'application/json')
} }
).subscribe(console.warn); ).subscribe(console.warn);