- Added JWT configuration to appsettings.json for secure token handling. - Updated config.json to include OAuth provider details for Microsoft, Google, and PocketId. - Added Microsoft icon SVG for UI representation. - Refactored app.config.ts to use a custom AuthInterceptor for managing access tokens. - Enhanced auth route guard to handle asynchronous authentication checks. - Created new auth models for structured request and response handling. - Developed a callback component to manage user login states and transitions. - Updated side-login component to support multiple OAuth providers with loading states. - Implemented authentication service methods for handling OAuth login flows and token management. - Added error handling and user feedback for authentication processes.
87 lines
3.7 KiB
C#
87 lines
3.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddUserAuthentication : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Users",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Email = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
|
FirstName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
LastName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
ProfilePictureUrl = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
LastLoginAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Users", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserOAuthProviders",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<int>(type: "int", nullable: false),
|
|
Provider = table.Column<int>(type: "int", nullable: false),
|
|
ProviderId = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
|
ProviderEmail = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
ProviderName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
LastUsedAt = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserOAuthProviders", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserOAuthProviders_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserOAuthProviders_Provider_ProviderId",
|
|
table: "UserOAuthProviders",
|
|
columns: new[] { "Provider", "ProviderId" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserOAuthProviders_UserId",
|
|
table: "UserOAuthProviders",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Users_Email",
|
|
table: "Users",
|
|
column: "Email",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserOAuthProviders");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Users");
|
|
}
|
|
}
|
|
}
|