Files
tuliprox/backend/app/src/api/model/app_state/auth_state.rs
T
euzuandGitHub 91f6c57159 Fix/merge live and vod recording (#876)
feat(dvr)!: unify live and VOD/series recording into one recoverable DVR

Merge fix/merge_live_and_vod_recording into develop.

- One recording queue for scheduled live captures and VOD/series transfers,
  with a shared transition graph, provider-slot scheduling, resumable HTTP
  transfers (strong ETag / Last-Modified validation) and ffmpeg live capture.
- Crash-recoverable persistence: B+Tree repository with a journal-first
  recovery history; one file can be shared by several library entries.
- Admission checks quota and disk on request, at transfer start (real size)
  and before an entry attaches to a finished file; idempotent requests.
- REST is command-only; state reaches clients via owner-filtered WebSocket
  snapshots.
- Deleting a recording removes the file once no entry holds it; removing an
  entry keeps a finished file and cleans up orphaned partials.
- User ids derive from the configured username (web:/api:); the identity
  registry is gone.
- Spanish locale added; ru/ar completed; locale parity test.

BREAKING CHANGE: `video.download` is now `video.recording` (nested
`recording` keys move up, `download_priority`/`recording_priority` become
`priority`); old configs fail to load with a migration hint.
BREAKING CHANGE: `/api/v1/file/download*` and `/file/record` are removed in
favour of `/api/v1/recording/*`.
BREAKING CHANGE: `download.*` and `recording.write` permissions are replaced
by `recording.read|create|manage|delete`; tokens from before the change must
re-authenticate.
BREAKING CHANGE: the old recording queue does not migrate; existing
`identity_registry.json` is ignored.
2026-10-04 16:02:55 +02:00

29 lines
1.1 KiB
Rust

use tuliprox_repository::token_revocations::TokenRevocations;
/// Sign-in and token revocation.
///
/// Subject identities need no state: a principal's `UserId` is derived from
/// its configured username (`web:<name>` / `api:<name>`).
pub struct AuthState {
/// Backoff for repeated failed sign-ins.
///
/// `/auth/token` used to answer 401 and forget, so a password list could
/// be worked against it as fast as argon2 allows.
pub login_throttle: crate::auth::LoginThrottle,
/// Revocation watermarks for already-issued tokens.
///
/// The tokens this server mints are stateless, so nothing could take one
/// back: a leak stayed valid until it expired.
pub token_revocations: TokenRevocations,
}
impl AuthState {
pub fn new(token_revocations: TokenRevocations) -> Self {
Self { login_throttle: crate::auth::LoginThrottle::new(), token_revocations }
}
/// An empty, unpersisted revocation list.
#[cfg(test)]
pub(crate) fn for_tests() -> Self { Self::new(TokenRevocations::empty(std::path::PathBuf::new())) }
}