Files
Chronos/src/Titano.Server/Security/AuditLog.cs
T
Claude c78747053e feat(server): API v1 with auth, uploads, sync, jobs, render nodes and events
- Security: PBKDF2-SHA512 (210,000 iterations) hashes, opaque bearer tokens
  stored as SHA-256 with sliding expiry and revocation, HttpOnly/Secure/
  SameSite=Strict admin cookie with a session-bound CSRF token, sign-in rate
  limit and lockout, role/permission metadata on every endpoint, audit log,
  first-run administrator bootstrap.
- Sequences with keyset paging, ETags and settings_version conflicts; sync
  manifest; frames, proxies, thumbnails and exports streamed with Range.
- Chunked resumable uploads with hash short-circuit, quota and disk checks,
  staging on the archive volume, SHA-256 verification and IArchiveIngest.
- Job engine host, jobs API, render nodes with heartbeat timeout and
  reassignment, WebSocket events, LAN discovery beacon, upload cleanup.
- Windows service host over advapi32 (--service, --install-service,
  --uninstall-service); fails fast without the archive module services.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 11:32:19 +00:00

27 lines
1.1 KiB
C#

using Titano.Core.Model;
using Titano.Data;
namespace Titano.Server.Security;
/// <summary>Appends who did what to the audit log (BRIEF §14.2): sign-ins, user, sequence, archive and setting changes.</summary>
public sealed class AuditLog(TitanoDatabase db, TimeProvider time)
{
public Task WriteAsync(Caller caller, HttpContext context, string action, string? targetKind = null, string? targetId = null, string? details = null) =>
WriteAsync(caller.Id, caller.User.Username, context, action, targetKind, targetId, details);
public Task WriteAsync(Guid? userId, string? username, HttpContext? context, string action, string? targetKind = null, string? targetId = null,
string? details = null) =>
db.Audit.AppendAsync(new AuditEntry
{
Id = Guid.CreateVersion7(),
At = time.GetUtcNow(),
UserId = userId,
Username = username,
Action = action,
TargetKind = targetKind,
TargetId = targetId,
Details = details,
RemoteAddress = context?.Connection.RemoteIpAddress?.ToString(),
});
}