feat(auth): add Redis authorization caching

This commit is contained in:
2026-08-01 12:20:31 +08:00
parent 84c2b0b21d
commit 46abf4d62f
36 changed files with 21757 additions and 35 deletions

View File

@@ -1,5 +1,6 @@
using System.Text.Json;
using Tiku.Domain.Common;
using Tiku.Domain.Tenancy;
namespace Tiku.Domain.Operations;
@@ -139,6 +140,26 @@ public sealed class PlatformBackendUserRole : Entity
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
}
public sealed class AuthorizationScopeVersion : AuditableEntity
{
public AuthRealm Realm { get; set; }
public Guid? TenantId { get; set; }
public long Version { get; set; } = 1;
}
public sealed class AuthorizationCacheInvalidation : AuditableEntity
{
public string TargetType { get; set; } = string.Empty;
public Guid? TenantId { get; set; }
public Guid? UserId { get; set; }
public Guid? SessionId { get; set; }
public AuthRealm? Realm { get; set; }
public long? Version { get; set; }
public DateTimeOffset? ProcessedAt { get; set; }
public int AttemptCount { get; set; }
public string? LastError { get; set; }
}
public sealed class BackgroundJob : AuditableTenantEntity
{
public string JobType { get; set; } = string.Empty;