Skip to main content

mz_auth/
lib.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10use serde::{Deserialize, Serialize};
11
12pub mod group_claims;
13pub mod hash;
14pub mod password;
15
16/// Identifies which authentication mechanism was used for a session.
17#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
18pub enum AuthenticatorKind {
19    /// Authenticated via Frontegg.
20    Frontegg,
21    /// Authenticated via internally stored password hashes.
22    Password,
23    /// Authenticated via SASL.
24    Sasl,
25    /// Authenticated via OIDC (JWT tokens).
26    Oidc,
27    /// No authentication performed.
28    #[default]
29    None,
30}
31
32/// A sentinel type signifying successful authentication.
33///
34/// This type is used to establish an authenticated Adapter client session,
35/// and should only be constructed by authenticators to indicate that authentication
36/// has succeeded. It may also be used when authentication is not required.
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct Authenticated;