Skip to content

Commit

Permalink
lock down sync api in lexbox to only be available to admins for now
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed May 17, 2024
1 parent 03dd80f commit b6fc351
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/LexBoxApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
app.MapQuartzUI("/api/quartz").RequireAuthorization(new AdminRequiredAttribute());
app.MapControllers();
app.MapLfClassicApi().RequireAuthorization(new AdminRequiredAttribute()).WithOpenApi();
app.MapSyncApi().AllowAnonymous().WithOpenApi();
app.MapSyncApi().WithOpenApi();
app.MapTus("/api/tus-test",
async context => await context.RequestServices.GetRequiredService<TusService>().GetTestConfig(context))
.RequireAuthorization(new AdminRequiredAttribute());
Expand Down
4 changes: 3 additions & 1 deletion backend/LexBoxApi/Services/CrdtSyncRoutes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Crdt.Core;
using LexBoxApi.Auth.Attributes;
using LexData;
using LexData.Entities;

Expand All @@ -9,7 +10,8 @@ public static class CrdtSyncRoutes
public static IEndpointConventionBuilder MapSyncApi(this IEndpointRouteBuilder endpoints,
string path = "/api/sync/{id}")
{
var group = endpoints.MapGroup(path);
//todo determine if the user has permission to access the project, for now lock down to admin only
var group = endpoints.MapGroup(path).RequireAuthorization(new AdminRequiredAttribute());
group.MapGet("/get",
async (Guid id, LexBoxDbContext dbContext) =>
{
Expand Down

0 comments on commit b6fc351

Please sign in to comment.