fradrive/models/auth.model

29 lines
1.3 KiB
Plaintext

-- SPDX-FileCopyrightText: 2024 Sarah Vaupel <sarah.vaupel@uniworx.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- | User authentication data, source-agnostic data
UserAuth
ident UserIdent -- Human-readable text uniquely identifying a user
lastLogin UTCTime -- When did the corresponding User last authenticate using this entry?
Primary ident
UniqueAuthentication ident
deriving Show Eq Ord Generic
-- | User authentication data fetched from external user sources
ExternalAuth
ident UserIdent
source AuthenticationSourceIdent -- Identifier of the external source in the config
data Value "default='{}'::jsonb" -- Raw user data from external source
lastSync UTCTime -- When was the corresponding User entry last synced with this external source?
UniqueExternalAuth ident source -- At most one entry of this user per source
deriving Show Eq Ord Generic
-- | FraDrive-specific user authentication data, internal logins have precedence over external authentication
InternalAuth
ident UserIdent
hash Text -- Hashed password
Primary ident
UniqueInternalAuth ident
deriving Show Eq Ord Generic