feat(auth): Added authentication
This commit is contained in:
parent
d85d4334f8
commit
5e100c75ed
39 changed files with 704 additions and 86 deletions
88
backend/src/Migrations/20260303190433_auth.Designer.cs
generated
Normal file
88
backend/src/Migrations/20260303190433_auth.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using JellyGlass.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace JellyGlassBackend.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20260303190433_auth")]
|
||||
partial class auth
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.11");
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.Server", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ApiToken")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Servers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserLogin", b =>
|
||||
{
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("HashedPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Username");
|
||||
|
||||
b.ToTable("Logins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserSession", b =>
|
||||
{
|
||||
b.Property<string>("SessionToken")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ExpiresOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LoginUsername")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("SessionToken");
|
||||
|
||||
b.HasIndex("LoginUsername");
|
||||
|
||||
b.ToTable("Sessions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserSession", b =>
|
||||
{
|
||||
b.HasOne("JellyGlass.Models.UserLogin", "Login")
|
||||
.WithMany()
|
||||
.HasForeignKey("LoginUsername");
|
||||
|
||||
b.Navigation("Login");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
60
backend/src/Migrations/20260303190433_auth.cs
Normal file
60
backend/src/Migrations/20260303190433_auth.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace JellyGlassBackend.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class auth : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Logins",
|
||||
columns: table => new
|
||||
{
|
||||
Username = table.Column<string>(type: "TEXT", nullable: false),
|
||||
HashedPassword = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Logins", x => x.Username);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Sessions",
|
||||
columns: table => new
|
||||
{
|
||||
SessionToken = table.Column<string>(type: "TEXT", nullable: false),
|
||||
LoginUsername = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ExpiresOn = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Sessions", x => x.SessionToken);
|
||||
table.ForeignKey(
|
||||
name: "FK_Sessions_Logins_LoginUsername",
|
||||
column: x => x.LoginUsername,
|
||||
principalTable: "Logins",
|
||||
principalColumn: "Username");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Sessions_LoginUsername",
|
||||
table: "Sessions",
|
||||
column: "LoginUsername");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Sessions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Logins");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using JellyGlass.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
@ -37,6 +38,47 @@ namespace JellyGlassBackend.Migrations
|
|||
|
||||
b.ToTable("Servers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserLogin", b =>
|
||||
{
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("HashedPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Username");
|
||||
|
||||
b.ToTable("Logins");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserSession", b =>
|
||||
{
|
||||
b.Property<string>("SessionToken")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ExpiresOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LoginUsername")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("SessionToken");
|
||||
|
||||
b.HasIndex("LoginUsername");
|
||||
|
||||
b.ToTable("Sessions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JellyGlass.Models.UserSession", b =>
|
||||
{
|
||||
b.HasOne("JellyGlass.Models.UserLogin", "Login")
|
||||
.WithMany()
|
||||
.HasForeignKey("LoginUsername");
|
||||
|
||||
b.Navigation("Login");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue