mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat(backend): implement api keys; rename token -> verificationToken in paste creation api
api keys can bypass authentication and captchas/verification
This commit is contained in:
@@ -11,6 +11,7 @@ namespace SharpbinV3.Server.Data
|
||||
public DbSet<RefreshToken> RefreshTokens => Set<RefreshToken>();
|
||||
public DbSet<UserTotp> UserTotps => Set<UserTotp>();
|
||||
public DbSet<Report> Reports => Set<Report>();
|
||||
public DbSet<ApiKey> ApiKeys => Set<ApiKey>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -56,6 +57,12 @@ namespace SharpbinV3.Server.Data
|
||||
.WithMany(u => u.Reports)
|
||||
.HasForeignKey(r => r.UserUUID)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
modelBuilder.Entity<ApiKey>()
|
||||
.HasOne(a => a.User)
|
||||
.WithMany(u => u.ApiKeys)
|
||||
.HasForeignKey(a => a.UserUUID)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user