feat: harden SaaS authentication and authorization

This commit is contained in:
2026-07-28 12:15:51 +08:00
parent f22f329d33
commit 5d2248efee
123 changed files with 9090 additions and 2822 deletions

View File

@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Tiku.Domain.Identity;
namespace Tiku.IntegrationTests.Api;
internal static class PasswordTestUserExtensions
{
public const string TestPassword = "passw0rd!123";
public static User WithTestPassword(this User user)
{
user.UserName ??= user.Phone ?? user.Email ?? user.Id.ToString("N");
user.NormalizedUserName ??= user.UserName.ToUpperInvariant();
var hasher = new PasswordHasher<User>(Options.Create(new PasswordHasherOptions
{
IterationCount = 210_000
}));
user.PasswordHash = hasher.HashPassword(user, TestPassword);
return user;
}
}